修改库存显示
This commit is contained in:
parent
bbc0be575d
commit
57c2ec2a0a
@ -328,33 +328,39 @@ namespace Milimoe.RainBOT.ListeningTask
|
||||
|
||||
if (e.detail == "创建存档")
|
||||
{
|
||||
if (!await Bot.CheckBlackList(true, e.user_id, e.group_id)) return quick_reply;
|
||||
string msg = (await Bot.HttpPost<string>($"https://api.milimoe.com/fungame/cjcd?qq={e.user_id}&name={e.sender.nickname}", "") ?? "").Trim();
|
||||
if (msg != "")
|
||||
{
|
||||
await Bot.SendGroupMessage(e.group_id, "创建存档", msg);
|
||||
await Bot.SendGroupMessageAt(e.user_id, e.group_id, "创建存档", msg);
|
||||
}
|
||||
return quick_reply;
|
||||
}
|
||||
|
||||
if (e.detail == "抽卡")
|
||||
{
|
||||
if (!await Bot.CheckBlackList(true, e.user_id, e.group_id)) return quick_reply;
|
||||
string msg = (await Bot.HttpPost<string>($"https://api.milimoe.com/fungame/ck?qq={e.user_id}", "") ?? "").Trim();
|
||||
if (msg != "")
|
||||
{
|
||||
await Bot.SendGroupMessage(e.group_id, "抽卡", msg);
|
||||
await Bot.SendGroupMessageAt(e.user_id, e.group_id, "抽卡", msg);
|
||||
}
|
||||
return quick_reply;
|
||||
}
|
||||
|
||||
if (e.detail == "查看库存")
|
||||
if (e.detail.Length >= 4 && e.detail[..4].Equals("查看库存", StringComparison.CurrentCultureIgnoreCase))
|
||||
{
|
||||
if (!await Bot.CheckBlackList(true, e.user_id, e.group_id)) return quick_reply;
|
||||
string msg = (await Bot.HttpPost<string>($"https://api.milimoe.com/fungame/ckkc?qq={e.user_id}", "") ?? "").Trim();
|
||||
if (msg != "")
|
||||
string detail = e.detail.Replace("查看库存", "").Trim();
|
||||
List<string> msgs = [];
|
||||
if (int.TryParse(detail, out int page))
|
||||
{
|
||||
await Bot.SendGroupMessage(e.group_id, "查看库存", msg);
|
||||
msgs = await Bot.HttpPost<List<string>>($"https://api.milimoe.com/fungame/ckkc2?qq={e.user_id}&page={page}", "") ?? [];
|
||||
}
|
||||
else
|
||||
{
|
||||
msgs = await Bot.HttpPost<List<string>>($"https://api.milimoe.com/fungame/ckkc2?qq={e.user_id}&page=1", "") ?? [];
|
||||
}
|
||||
if (msgs.Count > 0)
|
||||
{
|
||||
await Bot.SendGroupMessageAt(e.user_id, e.group_id, "查看库存", string.Join("\r\n", msgs));
|
||||
}
|
||||
return quick_reply;
|
||||
}
|
||||
|
||||
@ -167,6 +167,19 @@ namespace Milimoe.RainBOT.Settings
|
||||
}
|
||||
await SendMessage(SupportedAPI.send_group_msg, group_id, function, content, true);
|
||||
}
|
||||
|
||||
public static async Task SendGroupMessageAt(long at_id, long group_id, string function, string text, int delay = 0)
|
||||
{
|
||||
GroupMessageContent content = new(group_id);
|
||||
content.message.Add(new AtMessage(at_id));
|
||||
content.message.Add(new TextMessage(text));
|
||||
if (delay > 0)
|
||||
{
|
||||
await Task.Delay(delay);
|
||||
if (!GeneralSettings.IsRun) return;
|
||||
}
|
||||
await SendMessage(SupportedAPI.send_group_msg, group_id, function, content, true);
|
||||
}
|
||||
|
||||
public static async Task SendGroupMessage(long group_id, string function, IContent content) => await SendMessage(SupportedAPI.send_group_msg, group_id, function, content, true);
|
||||
|
||||
|
||||
@ -6,7 +6,7 @@ namespace Milimoe.RainBOT.Settings
|
||||
public class OSMCore
|
||||
{
|
||||
public const string version = "v1.0";
|
||||
public const string version2 = "Patch11";
|
||||
public const string version2 = "Patch12";
|
||||
|
||||
public static string Info => $"OSM Core {version} {version2}\r\nAuthor: Milimoe\r\nBuilt on {GetBuiltTime(Assembly.GetExecutingAssembly().Location)}\r\nSee: https://github.com/milimoe";
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user