Compare commits
10 Commits
bbc0be575d
...
32b70cd353
| Author | SHA1 | Date | |
|---|---|---|---|
| 32b70cd353 | |||
| 4d458fa985 | |||
| fdbc3f4612 | |||
| 78ad67f1dd | |||
| 52c7b029c1 | |||
| 7ab2588be2 | |||
| b3de0bfdb7 | |||
| 2d5110754e | |||
| c931a7b1ce | |||
| 57c2ec2a0a |
@ -242,6 +242,7 @@ namespace Milimoe.RainBOT.Command
|
|||||||
Daily.InitDaily();
|
Daily.InitDaily();
|
||||||
SayNo.InitSayNo();
|
SayNo.InitSayNo();
|
||||||
Ignore.InitIgnore();
|
Ignore.InitIgnore();
|
||||||
|
FunGame.FunGameSimulation = false;
|
||||||
SendMessage(send_group, target_id, "参数设定以及权限组重新加载完成。");
|
SendMessage(send_group, target_id, "参数设定以及权限组重新加载完成。");
|
||||||
}
|
}
|
||||||
else Access_Denied(send_group, target_id);
|
else Access_Denied(send_group, target_id);
|
||||||
|
|||||||
@ -52,16 +52,16 @@ namespace Milimoe.RainBOT.ListeningTask
|
|||||||
if (e.detail.Length >= 9 && e.detail[..9].Equals("FunGame模拟", StringComparison.CurrentCultureIgnoreCase))
|
if (e.detail.Length >= 9 && e.detail[..9].Equals("FunGame模拟", StringComparison.CurrentCultureIgnoreCase))
|
||||||
{
|
{
|
||||||
if (!await Bot.CheckBlackList(true, e.user_id, e.user_id)) return quick_reply;
|
if (!await Bot.CheckBlackList(true, e.user_id, e.user_id)) return quick_reply;
|
||||||
if (!Bot.FunGameSimulation)
|
if (!FunGame.FunGameSimulation)
|
||||||
{
|
{
|
||||||
Bot.FunGameSimulation = true;
|
FunGame.FunGameSimulation = true;
|
||||||
List<string> msgs = await Bot.HttpGet<List<string>>("https://api.milimoe.com/fungame/test?isweb=false") ?? [];
|
List<string> msgs = await Bot.HttpGet<List<string>>("https://api.milimoe.com/fungame/test?isweb=false") ?? [];
|
||||||
foreach (string msg in msgs)
|
foreach (string msg in msgs)
|
||||||
{
|
{
|
||||||
await Bot.SendFriendMessage(e.user_id, "FunGame模拟", msg.Trim());
|
await Bot.SendFriendMessage(e.user_id, "FunGame模拟", msg.Trim());
|
||||||
await Task.Delay(5500);
|
await Task.Delay(5500);
|
||||||
}
|
}
|
||||||
Bot.FunGameSimulation = false;
|
FunGame.FunGameSimulation = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,4 +1,6 @@
|
|||||||
using Milimoe.OneBot.Framework;
|
using System.Text.RegularExpressions;
|
||||||
|
using Microsoft.VisualBasic;
|
||||||
|
using Milimoe.OneBot.Framework;
|
||||||
using Milimoe.OneBot.Model.Content;
|
using Milimoe.OneBot.Model.Content;
|
||||||
using Milimoe.OneBot.Model.Event;
|
using Milimoe.OneBot.Model.Event;
|
||||||
using Milimoe.OneBot.Model.Message;
|
using Milimoe.OneBot.Model.Message;
|
||||||
@ -100,8 +102,10 @@ namespace Milimoe.RainBOT.ListeningTask
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!GeneralSettings.IsRun)
|
if (Ignore.CustomIgnore.Any(e.detail.Contains) && Bot.BotIsAdmin(e.group_id))
|
||||||
{
|
{
|
||||||
|
await Bot.SendMessage(SupportedAPI.delete_msg, e.group_id, "撤回", new DeleteMsgContent(e.real_id), true);
|
||||||
|
await Bot.SendMessage(SupportedAPI.set_group_ban, e.group_id, "禁言", new SetGroupBanContent(e.group_id, e.user_id, 120), true);
|
||||||
return quick_reply;
|
return quick_reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,258 +120,29 @@ namespace Milimoe.RainBOT.ListeningTask
|
|||||||
return quick_reply;
|
return quick_reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.detail.Length >= 9 && e.detail[..9].Equals("FunGame模拟", StringComparison.CurrentCultureIgnoreCase))
|
if (e.detail.StartsWith("查询任务计划"))
|
||||||
{
|
{
|
||||||
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;
|
||||||
if (!Bot.FunGameSimulation)
|
string detail = e.detail.Replace("查询任务计划", "").Trim();
|
||||||
{
|
string msg = await Bot.HttpGet<string>($"https://api.milimoe.com/test/gettask?name={detail}") ?? "";
|
||||||
Bot.FunGameSimulation = true;
|
|
||||||
List<string> msgs = await Bot.HttpGet<List<string>>("https://api.milimoe.com/fungame/test?isweb=false") ?? [];
|
|
||||||
List<string> real = [];
|
|
||||||
int remain = 7;
|
|
||||||
string merge = "";
|
|
||||||
for (int i = 0; i < msgs.Count - 2; i++)
|
|
||||||
{
|
|
||||||
remain--;
|
|
||||||
merge += msgs[i] + "\r\n";
|
|
||||||
if (remain == 0)
|
|
||||||
{
|
|
||||||
real.Add(merge);
|
|
||||||
merge = "";
|
|
||||||
if ((msgs.Count - i - 3) < 7)
|
|
||||||
{
|
|
||||||
remain = msgs.Count - i - 3;
|
|
||||||
}
|
|
||||||
else remain = 7;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (msgs.Count > 2)
|
|
||||||
{
|
|
||||||
real.Add(msgs[^2]);
|
|
||||||
real.Add(msgs[^1]);
|
|
||||||
}
|
|
||||||
foreach (string msg in real)
|
|
||||||
{
|
|
||||||
await Bot.SendGroupMessage(e.group_id, "FunGame模拟", msg.Trim());
|
|
||||||
await Task.Delay(5500);
|
|
||||||
}
|
|
||||||
Bot.FunGameSimulation = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
await Bot.SendGroupMessage(e.group_id, "FunGame模拟", "游戏正在模拟中,请勿重复请求!");
|
|
||||||
}
|
|
||||||
return quick_reply;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.detail.Length >= 11 && e.detail[..11].Equals("FunGame团队模拟", StringComparison.CurrentCultureIgnoreCase))
|
|
||||||
{
|
|
||||||
if (!await Bot.CheckBlackList(true, e.user_id, e.group_id)) return quick_reply;
|
|
||||||
if (!Bot.FunGameSimulation)
|
|
||||||
{
|
|
||||||
Bot.FunGameSimulation = true;
|
|
||||||
List<string> msgs = await Bot.HttpGet<List<string>>("https://api.milimoe.com/fungame/test?isweb=false&isteam=true") ?? [];
|
|
||||||
List<string> real = [];
|
|
||||||
if (msgs.Count > 0)
|
|
||||||
{
|
|
||||||
real.Add(msgs[0]);
|
|
||||||
}
|
|
||||||
int remain = 7;
|
|
||||||
string merge = "";
|
|
||||||
for (int i = 1; i < msgs.Count - 2; i++)
|
|
||||||
{
|
|
||||||
remain--;
|
|
||||||
merge += msgs[i] + "\r\n";
|
|
||||||
if (remain == 0)
|
|
||||||
{
|
|
||||||
real.Add(merge);
|
|
||||||
merge = "";
|
|
||||||
if ((msgs.Count - i - 3) < 7)
|
|
||||||
{
|
|
||||||
remain = msgs.Count - i - 3;
|
|
||||||
}
|
|
||||||
else remain = 7;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if (msgs.Count > 2)
|
|
||||||
{
|
|
||||||
real.Add(msgs[^2]);
|
|
||||||
real.Add(msgs[^1]);
|
|
||||||
}
|
|
||||||
foreach (string msg in real)
|
|
||||||
{
|
|
||||||
await Bot.SendGroupMessage(e.group_id, "FunGame团队模拟", msg.Trim());
|
|
||||||
await Task.Delay(5500);
|
|
||||||
}
|
|
||||||
Bot.FunGameSimulation = false;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
await Bot.SendGroupMessage(e.group_id, "FunGame团队模拟", "游戏正在模拟中,请勿重复请求!");
|
|
||||||
}
|
|
||||||
return quick_reply;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.detail.Length >= 3 && e.detail[..3].Equals("查数据", StringComparison.CurrentCultureIgnoreCase))
|
|
||||||
{
|
|
||||||
if (!await Bot.CheckBlackList(true, e.user_id, e.group_id)) return quick_reply;
|
|
||||||
string detail = e.detail.Replace("查数据", "").Trim();
|
|
||||||
if (int.TryParse(detail, out int id))
|
|
||||||
{
|
|
||||||
string msg = (await Bot.HttpGet<string>("https://api.milimoe.com/fungame/stats?id=" + id) ?? "").Trim();
|
|
||||||
if (msg != "")
|
if (msg != "")
|
||||||
{
|
{
|
||||||
await Bot.SendGroupMessage(e.group_id, "查询FunGame数据", msg);
|
await Bot.SendGroupMessage(e.group_id, "查询任务计划", msg);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return quick_reply;
|
return quick_reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.detail.Length >= 5 && e.detail[..5].Equals("查团队数据", StringComparison.CurrentCultureIgnoreCase))
|
if (!GeneralSettings.IsRun)
|
||||||
{
|
{
|
||||||
if (!await Bot.CheckBlackList(true, e.user_id, e.group_id)) return quick_reply;
|
|
||||||
string detail = e.detail.Replace("查团队数据", "").Trim();
|
|
||||||
if (int.TryParse(detail, out int id))
|
|
||||||
{
|
|
||||||
string msg = (await Bot.HttpGet<string>("https://api.milimoe.com/fungame/teamstats?id=" + id) ?? "").Trim();
|
|
||||||
if (msg != "")
|
|
||||||
{
|
|
||||||
await Bot.SendGroupMessage(e.group_id, "查询FunGame数据", msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return quick_reply;
|
return quick_reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (e.detail.Length >= 5 && e.detail[..5].Equals("查个人胜率", StringComparison.CurrentCultureIgnoreCase))
|
if (await FunGame.Handler(e))
|
||||||
{
|
{
|
||||||
if (!await Bot.CheckBlackList(true, e.user_id, e.group_id)) return quick_reply;
|
|
||||||
string[] msg = await Bot.HttpGet<string[]>("https://api.milimoe.com/fungame/winraterank?isteam=false") ?? [];
|
|
||||||
if (msg.Length > 0)
|
|
||||||
{
|
|
||||||
await Bot.SendGroupMessage(e.group_id, "查询FunGame数据", string.Join("\r\n\r\n", msg));
|
|
||||||
}
|
|
||||||
return quick_reply;
|
return quick_reply;
|
||||||
}
|
}
|
||||||
|
if (GeneralSettings.FunGameGroup.Contains(e.group_id))
|
||||||
if (e.detail.Length >= 5 && e.detail[..5].Equals("查团队胜率", StringComparison.CurrentCultureIgnoreCase))
|
|
||||||
{
|
{
|
||||||
if (!await Bot.CheckBlackList(true, e.user_id, e.group_id)) return quick_reply;
|
|
||||||
string[] msg = await Bot.HttpGet<string[]>("https://api.milimoe.com/fungame/winraterank?isteam=true") ?? [];
|
|
||||||
if (msg.Length > 0)
|
|
||||||
{
|
|
||||||
await Bot.SendGroupMessage(e.group_id, "查询FunGame数据", string.Join("\r\n\r\n", msg));
|
|
||||||
}
|
|
||||||
return quick_reply;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.detail.Length >= 3 && e.detail[..3].Equals("查角色", StringComparison.CurrentCultureIgnoreCase))
|
|
||||||
{
|
|
||||||
if (!await Bot.CheckBlackList(true, e.user_id, e.group_id)) return quick_reply;
|
|
||||||
string detail = e.detail.Replace("查角色", "").Trim();
|
|
||||||
if (int.TryParse(detail, out int id))
|
|
||||||
{
|
|
||||||
string msg = (await Bot.HttpGet<string>("https://api.milimoe.com/fungame/cjs?id=" + id) ?? "").Trim();
|
|
||||||
if (msg != "")
|
|
||||||
{
|
|
||||||
await Bot.SendGroupMessage(e.group_id, "查询FunGame角色技能", msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return quick_reply;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.detail.Length >= 3 && e.detail[..3].Equals("查技能", StringComparison.CurrentCultureIgnoreCase))
|
|
||||||
{
|
|
||||||
if (!await Bot.CheckBlackList(true, e.user_id, e.group_id)) return quick_reply;
|
|
||||||
string detail = e.detail.Replace("查技能", "").Trim();
|
|
||||||
if (int.TryParse(detail, out int id))
|
|
||||||
{
|
|
||||||
string msg = (await Bot.HttpGet<string>("https://api.milimoe.com/fungame/cjn?id=" + id) ?? "").Trim();
|
|
||||||
if (msg != "")
|
|
||||||
{
|
|
||||||
await Bot.SendGroupMessage(e.group_id, "查询FunGame角色技能", msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return quick_reply;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.detail.Length >= 3 && e.detail[..3].Equals("查物品", StringComparison.CurrentCultureIgnoreCase))
|
|
||||||
{
|
|
||||||
if (!await Bot.CheckBlackList(true, e.user_id, e.group_id)) return quick_reply;
|
|
||||||
string detail = e.detail.Replace("查物品", "").Trim();
|
|
||||||
if (int.TryParse(detail, out int id))
|
|
||||||
{
|
|
||||||
string msg = (await Bot.HttpGet<string>("https://api.milimoe.com/fungame/cwp?id=" + id) ?? "").Trim();
|
|
||||||
if (msg != "")
|
|
||||||
{
|
|
||||||
await Bot.SendGroupMessage(e.group_id, "查询FunGame角色技能", msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return quick_reply;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (e.detail.Length >= 6 && e.detail[..6] == "生成魔法卡包")
|
|
||||||
{
|
|
||||||
if (!await Bot.CheckBlackList(true, e.user_id, e.group_id)) return quick_reply;
|
|
||||||
string msg = (await Bot.HttpGet<string>("https://api.milimoe.com/fungame/mfkb") ?? "").Trim();
|
|
||||||
if (msg != "")
|
|
||||||
{
|
|
||||||
await Bot.SendGroupMessage(e.group_id, "生成魔法卡包", msg);
|
|
||||||
}
|
|
||||||
return quick_reply;
|
|
||||||
}
|
|
||||||
else if (e.detail.Length >= 5 && e.detail[..5] == "生成魔法卡")
|
|
||||||
{
|
|
||||||
if (!await Bot.CheckBlackList(true, e.user_id, e.group_id)) return quick_reply;
|
|
||||||
string msg = (await Bot.HttpGet<string>("https://api.milimoe.com/fungame/mfk") ?? "").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/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 (!await Bot.CheckBlackList(true, e.user_id, e.group_id)) return quick_reply;
|
|
||||||
string msg = (await Bot.HttpGet<string>("https://api.milimoe.com/fungame/reload?master=" + GeneralSettings.Master) ?? "").Trim();
|
|
||||||
if (msg != "")
|
|
||||||
{
|
|
||||||
await Bot.SendGroupMessage(e.group_id, "重载FunGame", msg);
|
|
||||||
}
|
|
||||||
return quick_reply;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// 发图API
|
// 发图API
|
||||||
@ -838,7 +613,22 @@ namespace Milimoe.RainBOT.ListeningTask
|
|||||||
{
|
{
|
||||||
GroupMessageContent content = new(e.group_id);
|
GroupMessageContent content = new(e.group_id);
|
||||||
content.message.Add(new AtMessage(e.user_id));
|
content.message.Add(new AtMessage(e.user_id));
|
||||||
|
switch (Random.Shared.Next(4))
|
||||||
|
{
|
||||||
|
case 0:
|
||||||
content.message.Add(new TextMessage(string.Concat(name.AsSpan(pos, name.Length > 1 ? 2 : name.Length), "哥")));
|
content.message.Add(new TextMessage(string.Concat(name.AsSpan(pos, name.Length > 1 ? 2 : name.Length), "哥")));
|
||||||
|
break;
|
||||||
|
case 1:
|
||||||
|
content.message.Add(new TextMessage(string.Concat(name.AsSpan(pos, name.Length > 1 ? 2 : name.Length), "姐")));
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
content.message.Add(new TextMessage(string.Concat(name.AsSpan(pos, name.Length > 0 ? 1 : name.Length), "圣")));
|
||||||
|
break;
|
||||||
|
case 3:
|
||||||
|
default:
|
||||||
|
content.message.Add(new TextMessage(string.Concat(name.AsSpan(pos, name.Length > 0 ? 1 : name.Length), "出")));
|
||||||
|
break;
|
||||||
|
}
|
||||||
await Bot.SendGroupMessage(e.group_id, "随机叫哥", content, delay * 1000);
|
await Bot.SendGroupMessage(e.group_id, "随机叫哥", content, delay * 1000);
|
||||||
return quick_reply;
|
return quick_reply;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,4 @@
|
|||||||
using System.IO;
|
using Milimoe.OneBot.Framework;
|
||||||
using Milimoe.OneBot.Framework;
|
|
||||||
using Milimoe.OneBot.Model.Content;
|
using Milimoe.OneBot.Model.Content;
|
||||||
using Milimoe.OneBot.Model.Message;
|
using Milimoe.OneBot.Model.Message;
|
||||||
using Milimoe.OneBot.Model.Other;
|
using Milimoe.OneBot.Model.Other;
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<OutputType>Exe</OutputType>
|
<OutputType>Exe</OutputType>
|
||||||
<TargetFramework>net8.0</TargetFramework>
|
<TargetFramework>net9.0</TargetFramework>
|
||||||
<RootNamespace>Milimoe.RainBOT</RootNamespace>
|
<RootNamespace>Milimoe.RainBOT</RootNamespace>
|
||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<Nullable>enable</Nullable>
|
<Nullable>enable</Nullable>
|
||||||
@ -22,7 +22,7 @@
|
|||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<Reference Include="OneBot-HTTPClient">
|
<Reference Include="OneBot-HTTPClient">
|
||||||
<HintPath>..\dll\OneBot-HTTPClient.dll</HintPath>
|
<HintPath>..\..\OneBot-HTTPClient\bin\Debug\net9.0\OneBot-HTTPClient.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
|||||||
@ -23,8 +23,6 @@ namespace Milimoe.RainBOT.Settings
|
|||||||
|
|
||||||
public static Dictionary<long, List<Member>> GroupMembers { get; set; } = [];
|
public static Dictionary<long, List<Member>> GroupMembers { get; set; } = [];
|
||||||
|
|
||||||
public static bool FunGameSimulation { get; set; } = false;
|
|
||||||
|
|
||||||
public static bool IsAdmin(long group_id, long user_id)
|
public static bool IsAdmin(long group_id, long user_id)
|
||||||
{
|
{
|
||||||
if (GroupMembers.TryGetValue(group_id, out List<Member>? members) && members != null && members.Any(m => m.user_id == user_id && (m.role == "owner" || m.role == "admin")))
|
if (GroupMembers.TryGetValue(group_id, out List<Member>? members) && members != null && members.Any(m => m.user_id == user_id && (m.role == "owner" || m.role == "admin")))
|
||||||
@ -168,6 +166,19 @@ namespace Milimoe.RainBOT.Settings
|
|||||||
await SendMessage(SupportedAPI.send_group_msg, group_id, function, content, true);
|
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);
|
public static async Task SendGroupMessage(long group_id, string function, IContent content) => await SendMessage(SupportedAPI.send_group_msg, group_id, function, content, true);
|
||||||
|
|
||||||
public static async Task SendGroupMessage(long group_id, string function, IContent content, int delay = 0)
|
public static async Task SendGroupMessage(long group_id, string function, IContent content, int delay = 0)
|
||||||
@ -333,8 +344,9 @@ namespace Milimoe.RainBOT.Settings
|
|||||||
|
|
||||||
private static readonly HttpClient client = new();
|
private static readonly HttpClient client = new();
|
||||||
|
|
||||||
public static async Task<T?> HttpGet<T>(string url)
|
public static async Task<T?> HttpGet<T>(string url, bool fungame = false)
|
||||||
{
|
{
|
||||||
|
if (fungame) client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", GeneralSettings.FunGameToken);
|
||||||
HttpResponseMessage response = await client.GetAsync(url);
|
HttpResponseMessage response = await client.GetAsync(url);
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
|
|
||||||
@ -343,9 +355,10 @@ 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 = "", bool fungame = false)
|
||||||
{
|
{
|
||||||
HttpContent content = new StringContent(json, Encoding.UTF8, "application/json");
|
HttpContent content = new StringContent(json, Encoding.UTF8, "application/json");
|
||||||
|
if (fungame) client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Bearer", GeneralSettings.FunGameToken);
|
||||||
HttpResponseMessage response = await client.PostAsync(url, content);
|
HttpResponseMessage response = await client.PostAsync(url, content);
|
||||||
response.EnsureSuccessStatusCode();
|
response.EnsureSuccessStatusCode();
|
||||||
|
|
||||||
|
|||||||
1459
src/Settings/FunGame.cs
Normal file
1459
src/Settings/FunGame.cs
Normal file
File diff suppressed because it is too large
Load Diff
@ -54,6 +54,10 @@ namespace Milimoe.RainBOT.Settings
|
|||||||
|
|
||||||
public static List<long> OSMCoreGroup { get; set; } = [];
|
public static List<long> OSMCoreGroup { get; set; } = [];
|
||||||
|
|
||||||
|
public static List<long> FunGameGroup { get; set; } = [];
|
||||||
|
|
||||||
|
public static string FunGameToken { get; set; } = "";
|
||||||
|
|
||||||
public static PluginConfig Configs { get; set; } = new("rainbot", "config");
|
public static PluginConfig Configs { get; set; } = new("rainbot", "config");
|
||||||
|
|
||||||
public static void LoadSetting()
|
public static void LoadSetting()
|
||||||
@ -152,6 +156,14 @@ namespace Milimoe.RainBOT.Settings
|
|||||||
{
|
{
|
||||||
OSMCoreGroup = (List<long>)value;
|
OSMCoreGroup = (List<long>)value;
|
||||||
}
|
}
|
||||||
|
if (configs.TryGetValue("FunGameGroup", out value) && value != null)
|
||||||
|
{
|
||||||
|
FunGameGroup = (List<long>)value;
|
||||||
|
}
|
||||||
|
if (configs.TryGetValue("FunGameToken", out value) && value != null)
|
||||||
|
{
|
||||||
|
FunGameToken = (string)value;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SaveConfig()
|
public static void SaveConfig()
|
||||||
@ -178,6 +190,8 @@ namespace Milimoe.RainBOT.Settings
|
|||||||
Configs.Add("RecallAccessGroup", RecallAccessGroup);
|
Configs.Add("RecallAccessGroup", RecallAccessGroup);
|
||||||
Configs.Add("SayNoAccessGroup", SayNoAccessGroup);
|
Configs.Add("SayNoAccessGroup", SayNoAccessGroup);
|
||||||
Configs.Add("OSMCoreGroup", OSMCoreGroup);
|
Configs.Add("OSMCoreGroup", OSMCoreGroup);
|
||||||
|
Configs.Add("FunGameGroup", FunGameGroup);
|
||||||
|
Configs.Add("FunGameToken", FunGameToken);
|
||||||
Configs.Save();
|
Configs.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -201,6 +215,9 @@ namespace Milimoe.RainBOT.Settings
|
|||||||
case "osmcoregroup":
|
case "osmcoregroup":
|
||||||
list = OSMCoreGroup;
|
list = OSMCoreGroup;
|
||||||
break;
|
break;
|
||||||
|
case "fungamegroup":
|
||||||
|
list = FunGameGroup;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
string msg = list.Count > 0 ? "权限组" + group + "拥有以下成员:" + "\r\n" + string.Join("\r\n", list) : "此权限组不存在或没有任何成员。";
|
string msg = list.Count > 0 ? "权限组" + group + "拥有以下成员:" + "\r\n" + string.Join("\r\n", list) : "此权限组不存在或没有任何成员。";
|
||||||
_ = isgroup ? Bot.SendGroupMessage(target, "显示列表成员", msg) : Bot.SendFriendMessage(target, "显示列表成员", msg);
|
_ = isgroup ? Bot.SendGroupMessage(target, "显示列表成员", msg) : Bot.SendFriendMessage(target, "显示列表成员", msg);
|
||||||
|
|||||||
@ -17,6 +17,8 @@ namespace Milimoe.RainBOT.Settings
|
|||||||
|
|
||||||
public static List<long> ReverseAtIgnore { get; set; } = [];
|
public static List<long> ReverseAtIgnore { get; set; } = [];
|
||||||
|
|
||||||
|
public static HashSet<string> CustomIgnore { get; set; } = [];
|
||||||
|
|
||||||
public static PluginConfig Configs { get; set; } = new("rainbot", "ignore");
|
public static PluginConfig Configs { get; set; } = new("rainbot", "ignore");
|
||||||
|
|
||||||
public static void InitIgnore()
|
public static void InitIgnore()
|
||||||
@ -52,6 +54,7 @@ namespace Milimoe.RainBOT.Settings
|
|||||||
Configs.Add("QQGroupIgnore", QQGroupIgnore);
|
Configs.Add("QQGroupIgnore", QQGroupIgnore);
|
||||||
Configs.Add("RepeatQQIgnore", RepeatQQIgnore);
|
Configs.Add("RepeatQQIgnore", RepeatQQIgnore);
|
||||||
Configs.Add("ReverseAtIgnore", ReverseAtIgnore);
|
Configs.Add("ReverseAtIgnore", ReverseAtIgnore);
|
||||||
|
Configs.Add("CustomIgnore", CustomIgnore);
|
||||||
Configs.Save();
|
Configs.Save();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -94,6 +97,10 @@ namespace Milimoe.RainBOT.Settings
|
|||||||
else ReverseAtIgnore.Remove(lv);
|
else ReverseAtIgnore.Remove(lv);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case "customignore":
|
||||||
|
if (isadd) CustomIgnore.Add(strv);
|
||||||
|
else CustomIgnore.Remove(strv);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -125,6 +132,9 @@ namespace Milimoe.RainBOT.Settings
|
|||||||
case "reverseatignore":
|
case "reverseatignore":
|
||||||
list = ReverseAtIgnore.Select(x => x.ToString()).ToList();
|
list = ReverseAtIgnore.Select(x => x.ToString()).ToList();
|
||||||
break;
|
break;
|
||||||
|
case "customignore":
|
||||||
|
list = CustomIgnore.Select(x => x.ToString()).ToList();
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
string msg = list.Count > 0 ? "列表" + group + "拥有以下成员:" + "\r\n" + string.Join("\r\n", list) : "此列表不存在或没有任何成员。";
|
string msg = list.Count > 0 ? "列表" + group + "拥有以下成员:" + "\r\n" + string.Join("\r\n", list) : "此列表不存在或没有任何成员。";
|
||||||
_ = isgroup ? Bot.SendGroupMessage(target, "显示列表成员", msg) : Bot.SendFriendMessage(target, "显示列表成员", msg);
|
_ = isgroup ? Bot.SendGroupMessage(target, "显示列表成员", msg) : Bot.SendFriendMessage(target, "显示列表成员", msg);
|
||||||
|
|||||||
@ -6,7 +6,7 @@ namespace Milimoe.RainBOT.Settings
|
|||||||
public class OSMCore
|
public class OSMCore
|
||||||
{
|
{
|
||||||
public const string version = "v1.0";
|
public const string version = "v1.0";
|
||||||
public const string version2 = "Patch11";
|
public const string version2 = "Patch12 V1";
|
||||||
|
|
||||||
public static string Info => $"OSM Core {version} {version2}\r\nAuthor: Milimoe\r\nBuilt on {GetBuiltTime(Assembly.GetExecutingAssembly().Location)}\r\nSee: https://github.com/milimoe";
|
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