fix: 小小 药材价格查询 秘境通知修复
This commit is contained in:
@@ -14,7 +14,7 @@ namespace NapCatRobotClient.Service.Group.TextProcess
|
||||
{
|
||||
JObject json = JObject.Parse(message);
|
||||
var messageArray = JArray.Parse(json["message"].ToString());
|
||||
string groupMsg = messageArray.FirstOrDefault(o => o["type"].ToString() == "text"
|
||||
string groupMsg = messageArray.LastOrDefault(o => o["type"].ToString() == "text"
|
||||
&& !string.IsNullOrWhiteSpace(o["data"]["text"].ToString()))?["data"]?["text"]?.ToString();
|
||||
if (string.IsNullOrWhiteSpace(groupMsg)) return false;
|
||||
|
||||
|
||||
+11
-5
@@ -1,4 +1,5 @@
|
||||
using Furion.Logging;
|
||||
using static Microsoft.Extensions.Logging.EventSource.LoggingEventSource;
|
||||
|
||||
namespace NapCatRobotClient.Service.Group.TextProcess
|
||||
{
|
||||
@@ -16,18 +17,23 @@ namespace NapCatRobotClient.Service.Group.TextProcess
|
||||
if (message.Contains("不鼓励不保障"))
|
||||
{
|
||||
JObject json = JObject.Parse(message);
|
||||
message = json["message"]?.ToString();
|
||||
message = JArray.Parse(message).FirstOrDefault(o => o["type"].ToString() == "text" && !string.IsNullOrWhiteSpace(o["data"]["text"].ToString()))["data"]["text"]?.ToString();
|
||||
if (string.IsNullOrWhiteSpace(message)) return false;
|
||||
string jsonMessage = json["message"]?.ToString();
|
||||
|
||||
jsonMessage = JArray.Parse(jsonMessage)
|
||||
.Where(x => x?["type"]?.ToString() == "text")
|
||||
.Select(x => x?["data"]?["text"]?.ToString())
|
||||
.FirstOrDefault(t => !string.IsNullOrWhiteSpace(t) && new string[] { "不鼓励不保障" }.All(k => t.Contains(k)));
|
||||
|
||||
if (string.IsNullOrWhiteSpace(jsonMessage)) return false;
|
||||
|
||||
List<GoodsInfo> results = new();
|
||||
|
||||
MatchCollection matches = Regex.Matches(message);
|
||||
MatchCollection matches = Regex.Matches(jsonMessage);
|
||||
|
||||
foreach (Match match in matches)
|
||||
{
|
||||
string price = match.Groups[1].Value;
|
||||
string name = match.Groups[2].Value.Replace("\u200b", "").Replace("\u200c", "").Replace("\u200d", ""); // 去除零宽字符
|
||||
string name = match.Groups[2].Value.Replace("\u200b", "").Replace("\u200c", "").Replace("\u200d", "").Replace("?", ""); // 去除零宽字符
|
||||
GoodsInfo gds = new()
|
||||
{
|
||||
Name = name,
|
||||
|
||||
@@ -46,7 +46,7 @@ namespace NapCatRobotClient.Service.Group.TextProcess
|
||||
if (string.IsNullOrWhiteSpace(groupMsg)) return false;
|
||||
|
||||
List<GoodsInfo> goods = new();
|
||||
if (groupMsg.Contains("道友的灵田还不能收取")|| groupMsg.Contains("道友的灵田灵气未满"))
|
||||
if (groupMsg.Contains("道友的灵田还不能收取") || groupMsg.Contains("道友的灵田灵气未满"))
|
||||
{
|
||||
double ts = ConvertLastTime(groupMsg);
|
||||
if (ts > 0)
|
||||
|
||||
+6
-5
@@ -1,5 +1,6 @@
|
||||
using Furion.Logging;
|
||||
using System.Globalization;
|
||||
using static Microsoft.Extensions.Logging.EventSource.LoggingEventSource;
|
||||
|
||||
namespace NapCatRobotClient.Service.Group.TextProcess
|
||||
{
|
||||
@@ -24,11 +25,11 @@ namespace NapCatRobotClient.Service.Group.TextProcess
|
||||
List<string> keywords = new() { "进入秘境", "道友已踏入", "道友已破界", "道友已遁入", "道友已降临" };
|
||||
|
||||
string groupMsg = messageArray
|
||||
.FirstOrDefault(o =>
|
||||
o["type"]?.ToString() == "text"
|
||||
&& !string.IsNullOrWhiteSpace(o["data"]?["text"]?.ToString())
|
||||
&& keywords.Any(k => o["data"]["text"].ToString().Contains(k))
|
||||
)?["data"]?["text"]?.ToString();
|
||||
.FirstOrDefault(o =>
|
||||
o["type"]?.ToString() == "text"
|
||||
&& !string.IsNullOrWhiteSpace(o["data"]?["text"]?.ToString())
|
||||
&& keywords.Any(k => o["data"]["text"].ToString().Contains(k))
|
||||
)?["data"]?["text"]?.ToString();
|
||||
if (string.IsNullOrWhiteSpace(groupMsg)) return false;
|
||||
|
||||
var minutes = ParseMinutes(groupMsg);
|
||||
|
||||
Reference in New Issue
Block a user