add api
This commit is contained in:
parent
d4f35b5e8f
commit
bbc0be575d
@ -326,6 +326,39 @@ namespace Milimoe.RainBOT.ListeningTask
|
|||||||
return quick_reply;
|
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/cjcd?qq={e.user_id}&name={e.sender.nickname}", "") ?? "").Trim();
|
||||||
|
if (msg != "")
|
||||||
|
{
|
||||||
|
await Bot.SendGroupMessage(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);
|
||||||
|
}
|
||||||
|
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/ckkc?qq={e.user_id}", "") ?? "").Trim();
|
||||||
|
if (msg != "")
|
||||||
|
{
|
||||||
|
await Bot.SendGroupMessage(e.group_id, "查看库存", msg);
|
||||||
|
}
|
||||||
|
return quick_reply;
|
||||||
|
}
|
||||||
|
|
||||||
if (e.user_id == GeneralSettings.Master && e.detail.Length >= 9 && e.detail[..9].Equals("重载FunGame", StringComparison.CurrentCultureIgnoreCase))
|
if (e.user_id == GeneralSettings.Master && e.detail.Length >= 9 && e.detail[..9].Equals("重载FunGame", StringComparison.CurrentCultureIgnoreCase))
|
||||||
{
|
{
|
||||||
if (!await Bot.CheckBlackList(true, e.user_id, e.group_id)) return quick_reply;
|
if (!await Bot.CheckBlackList(true, e.user_id, e.group_id)) return quick_reply;
|
||||||
|
|||||||
@ -343,7 +343,7 @@ namespace Milimoe.RainBOT.Settings
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static async Task<T?> HttpPost<T>(string url, string json)
|
public static async Task<T?> HttpPost<T>(string url, string json = "")
|
||||||
{
|
{
|
||||||
HttpContent content = new StringContent(json, Encoding.UTF8, "application/json");
|
HttpContent content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||||
HttpResponseMessage response = await client.PostAsync(url, content);
|
HttpResponseMessage response = await client.PostAsync(url, content);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user