feat: 灵田结算适配新版文字
This commit is contained in:
@@ -23,13 +23,30 @@ namespace NapCatRobotClient.Service.Group.TextProcess
|
||||
{
|
||||
return false;
|
||||
}
|
||||
string groupMsg = null;
|
||||
|
||||
var keywords = new[]
|
||||
{
|
||||
"道友的灵田还不能收取",
|
||||
"道友本次采集成果",
|
||||
"道友成功收获药材",
|
||||
"道友的灵田灵气未满"
|
||||
};
|
||||
|
||||
var messageArray = JArray.Parse(json["message"].ToString());
|
||||
|
||||
groupMsg = messageArray
|
||||
.Where(o => o["type"]?.ToString() == "text")
|
||||
.Select(o => o["data"]?["text"]?.ToString())
|
||||
.FirstOrDefault(text =>
|
||||
!string.IsNullOrWhiteSpace(text) &&
|
||||
keywords.Any(k => text.Contains(k))
|
||||
);
|
||||
|
||||
string groupMsg = JArray.Parse(json["message"].ToString()).FirstOrDefault(o => o["type"].ToString() == "text"
|
||||
&& !string.IsNullOrWhiteSpace(o["data"]["text"].ToString()) && (o["data"]["text"].ToString().Contains("道友的灵田还不能收取") || o["data"]["text"].ToString().Contains("道友本次采集成果") || o["data"]["text"].ToString().Contains("道友成功收获药材")))?["data"]?["text"]?.ToString();
|
||||
if (string.IsNullOrWhiteSpace(groupMsg)) return false;
|
||||
|
||||
List<GoodsInfo> goods = new();
|
||||
if (groupMsg.Contains("道友的灵田还不能收取"))
|
||||
if (groupMsg.Contains("道友的灵田还不能收取")|| groupMsg.Contains("道友的灵田灵气未满"))
|
||||
{
|
||||
double ts = ConvertLastTime(groupMsg);
|
||||
if (ts > 0)
|
||||
@@ -149,6 +166,10 @@ namespace NapCatRobotClient.Service.Group.TextProcess
|
||||
if (match.Success)
|
||||
{
|
||||
hours = double.Parse(match.Groups[1].Value);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
}
|
||||
return hours;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user