From 78ad67f1dd510fc2e75e805dc5a5a0dc0984aa07 Mon Sep 17 00:00:00 2001 From: milimoe Date: Wed, 11 Dec 2024 21:20:01 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9C=A8=E6=88=91=E7=9A=84=E5=BA=93=E5=AD=98?= =?UTF-8?q?=E5=90=8E=E9=9D=A2=E8=83=BD=E7=9B=B4=E6=8E=A5=E6=9F=A5=E8=AF=A2?= =?UTF-8?q?=E5=88=86=E7=B1=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ListeningTask/GroupMessageTask.cs | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/src/ListeningTask/GroupMessageTask.cs b/src/ListeningTask/GroupMessageTask.cs index 8b84f7c..3c4a685 100644 --- a/src/ListeningTask/GroupMessageTask.cs +++ b/src/ListeningTask/GroupMessageTask.cs @@ -15,7 +15,7 @@ namespace Milimoe.RainBOT.ListeningTask private static long dice = 0; private readonly static string[] EEWords = ["ee", "鹅鹅", "呃呃", "谔谔", "饿饿"]; private readonly static string[] MuteCommands = ["禁言", "解禁"]; - private readonly static string[] FunGameItemType = ["魔法卡包", "武器", "防具", "鞋子", "饰品", "消耗品", "魔法卡", "收藏品", "特殊物品", "任务物品", "礼包", "其他"]; + private readonly static List FunGameItemType = ["卡包", "武器", "防具", "鞋子", "饰品", "消耗品", "魔法卡", "收藏品", "特殊物品", "任务物品", "礼包", "其他"]; public static async Task ListeningTask_handler(GroupMessageEvent e) { @@ -437,7 +437,7 @@ namespace Milimoe.RainBOT.ListeningTask return quick_reply; } - if (e.detail.Length >= 4 && (e.detail.StartsWith("查看库存") || e.detail.StartsWith("我的库存"))) + if (e.detail.Length >= 4 && (e.detail.StartsWith("查看库存") || e.detail.StartsWith("我的库存") || e.detail.StartsWith("我的背包"))) { string detail = e.detail.Replace("查看库存", "").Replace("我的库存", "").Trim(); List msgs = []; @@ -445,6 +445,19 @@ namespace Milimoe.RainBOT.ListeningTask { msgs = await Bot.HttpPost>($"https://api.milimoe.com/fungame/inventoryinfo2?qq={e.user_id}&page={page}", "") ?? []; } + else if (FunGameItemType.FirstOrDefault(detail.Contains) is string matchedType) + { + int typeIndex = FunGameItemType.IndexOf(matchedType); + string remain = detail.Replace(matchedType, "").Trim(); + if (int.TryParse(remain, out page)) + { + msgs = await Bot.HttpPost>($"https://api.milimoe.com/fungame/inventoryinfo4?qq={e.user_id}&page={page}&type={typeIndex}", "") ?? []; + } + else + { + msgs = await Bot.HttpPost>($"https://api.milimoe.com/fungame/inventoryinfo4?qq={e.user_id}&page=1&type={typeIndex}", "") ?? []; + } + } else { msgs = await Bot.HttpPost>($"https://api.milimoe.com/fungame/inventoryinfo2?qq={e.user_id}&page=1", "") ?? []; @@ -517,7 +530,7 @@ namespace Milimoe.RainBOT.ListeningTask } return quick_reply; } - + if (e.detail.Length >= 3 && e.detail[..3].Equals("我角色", StringComparison.CurrentCultureIgnoreCase)) { string detail = e.detail.Replace("我角色", "").Trim();