在我的库存后面能直接查询分类

This commit is contained in:
milimoe 2024-12-11 21:20:01 +08:00
parent 52c7b029c1
commit 78ad67f1dd
Signed by: milimoe
GPG Key ID: 05D280912DA6C69E

View File

@ -15,7 +15,7 @@ namespace Milimoe.RainBOT.ListeningTask
private static long dice = 0; private static long dice = 0;
private readonly static string[] EEWords = ["ee", "鹅鹅", "呃呃", "谔谔", "饿饿"]; private readonly static string[] EEWords = ["ee", "鹅鹅", "呃呃", "谔谔", "饿饿"];
private readonly static string[] MuteCommands = ["禁言", "解禁"]; private readonly static string[] MuteCommands = ["禁言", "解禁"];
private readonly static string[] FunGameItemType = ["魔法卡包", "武器", "防具", "鞋子", "饰品", "消耗品", "魔法卡", "收藏品", "特殊物品", "任务物品", "礼包", "其他"]; private readonly static List<string> FunGameItemType = ["卡包", "武器", "防具", "鞋子", "饰品", "消耗品", "魔法卡", "收藏品", "特殊物品", "任务物品", "礼包", "其他"];
public static async Task<GroupMsgEventQuickReply?> ListeningTask_handler(GroupMessageEvent e) public static async Task<GroupMsgEventQuickReply?> ListeningTask_handler(GroupMessageEvent e)
{ {
@ -437,7 +437,7 @@ namespace Milimoe.RainBOT.ListeningTask
return quick_reply; 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(); string detail = e.detail.Replace("查看库存", "").Replace("我的库存", "").Trim();
List<string> msgs = []; List<string> msgs = [];
@ -445,6 +445,19 @@ namespace Milimoe.RainBOT.ListeningTask
{ {
msgs = await Bot.HttpPost<List<string>>($"https://api.milimoe.com/fungame/inventoryinfo2?qq={e.user_id}&page={page}", "") ?? []; msgs = await Bot.HttpPost<List<string>>($"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<List<string>>($"https://api.milimoe.com/fungame/inventoryinfo4?qq={e.user_id}&page={page}&type={typeIndex}", "") ?? [];
}
else
{
msgs = await Bot.HttpPost<List<string>>($"https://api.milimoe.com/fungame/inventoryinfo4?qq={e.user_id}&page=1&type={typeIndex}", "") ?? [];
}
}
else else
{ {
msgs = await Bot.HttpPost<List<string>>($"https://api.milimoe.com/fungame/inventoryinfo2?qq={e.user_id}&page=1", "") ?? []; msgs = await Bot.HttpPost<List<string>>($"https://api.milimoe.com/fungame/inventoryinfo2?qq={e.user_id}&page=1", "") ?? [];