From 45ad0e3b47d775b05d8b227f5034fda573b5ab70 Mon Sep 17 00:00:00 2001 From: milimoe Date: Mon, 17 Nov 2025 22:16:52 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E6=B8=85=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/ListeningTask/GroupMessageTask.cs | 8 ++-- src/Settings/Bot.cs | 7 ++-- src/Settings/GeneralSettings.cs | 10 ++--- src/Settings/Ignore.cs | 4 +- src/Settings/OSMCore.cs | 6 +-- src/Settings/OshimaController.cs | 6 +-- src/Settings/RainBOTFunGame.cs | 58 +++++++++++++-------------- src/Settings/SayNo.cs | 2 +- 8 files changed, 50 insertions(+), 51 deletions(-) diff --git a/src/ListeningTask/GroupMessageTask.cs b/src/ListeningTask/GroupMessageTask.cs index 6b1c277..129aba2 100644 --- a/src/ListeningTask/GroupMessageTask.cs +++ b/src/ListeningTask/GroupMessageTask.cs @@ -127,21 +127,21 @@ namespace Milimoe.RainBOT.ListeningTask _ = OshimaController.Instance.SCList(e.group_id, e.user_id); return quick_reply; } - + if (e.detail.Contains("出生榜")) { if (!await Bot.CheckBlackList(true, e.user_id, e.group_id)) return quick_reply; _ = OshimaController.Instance.SCList(e.group_id, e.user_id, true); return quick_reply; } - + if (e.detail.Contains("圣人点数") || e.detail == "查询sc" || e.detail == "sc查询") { if (!await Bot.CheckBlackList(true, e.user_id, e.group_id)) return quick_reply; _ = OshimaController.Instance.SCRecord(e.group_id, e.user_id); return quick_reply; } - + if (e.detail == "查询服务器启动时间") { if (!await Bot.CheckBlackList(true, e.user_id, e.group_id)) return quick_reply; @@ -152,7 +152,7 @@ namespace Milimoe.RainBOT.ListeningTask } return quick_reply; } - + if (e.detail.StartsWith("查询任务计划")) { if (!await Bot.CheckBlackList(true, e.user_id, e.group_id)) return quick_reply; diff --git a/src/Settings/Bot.cs b/src/Settings/Bot.cs index c09f6c2..2b6767c 100644 --- a/src/Settings/Bot.cs +++ b/src/Settings/Bot.cs @@ -7,7 +7,6 @@ using Milimoe.OneBot.Framework.Utility; using Milimoe.OneBot.Model.Content; using Milimoe.OneBot.Model.Message; using Milimoe.OneBot.Model.Other; -using Milimoe.OneBot.Utility; using Milimoe.RainBOT.Command; using Group = Milimoe.OneBot.Model.Other.Group; @@ -165,7 +164,7 @@ 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); @@ -190,7 +189,7 @@ namespace Milimoe.RainBOT.Settings } await SendMessage(SupportedAPI.send_group_msg, group_id, function, content, true); } - + public static async Task SendGroupMessage(long group_id, string function, IEnumerable contents) => await SendMessage(SupportedAPI.send_group_msg, group_id, function, contents, true); public static async Task SendFriendMessage(long user_id, string function, string text) @@ -354,7 +353,7 @@ namespace Milimoe.RainBOT.Settings T? result = JsonSerializer.Deserialize(content); return result; } - + public static async Task HttpPost(string url, string json = "", bool fungame = false) { HttpContent content = new StringContent(json, Encoding.UTF8, "application/json"); diff --git a/src/Settings/GeneralSettings.cs b/src/Settings/GeneralSettings.cs index c67e5df..db2b789 100644 --- a/src/Settings/GeneralSettings.cs +++ b/src/Settings/GeneralSettings.cs @@ -35,13 +35,13 @@ namespace Milimoe.RainBOT.Settings public static bool IsCallBrother { get; set; } = true; public static long PCallBrother { get; set; } = 4; - + public static bool IsAI { get; set; } = true; public static long PAI { get; set; } = 100; public static bool IsDebug { get; set; } = false; - + public static bool IsQQBot { get; set; } = false; public static long DebugGroupID { get; set; } = 0; @@ -59,15 +59,15 @@ namespace Milimoe.RainBOT.Settings public static List SayNoAccessGroup { get; set; } = []; public static List OSMCoreGroup { get; set; } = []; - + public static List FunGameGroup { get; set; } = []; - + public static List FunGameWebSocketGroup { get; set; } = []; public static string FunGameServer { get; set; } = ""; public static string FunGameToken { get; set; } = ""; - + public static string AIAPIToken { get; set; } = ""; public static PluginConfig Configs { get; set; } = new("rainbot", "config"); diff --git a/src/Settings/Ignore.cs b/src/Settings/Ignore.cs index 093da92..8baab9e 100644 --- a/src/Settings/Ignore.cs +++ b/src/Settings/Ignore.cs @@ -16,7 +16,7 @@ namespace Milimoe.RainBOT.Settings public static List RepeatQQIgnore { get; set; } = []; public static List ReverseAtIgnore { get; set; } = []; - + public static HashSet CustomIgnore { get; set; } = []; public static PluginConfig Configs { get; set; } = new("rainbot", "ignore"); @@ -122,7 +122,7 @@ namespace Milimoe.RainBOT.Settings switch (group.ToLower()) { case "repeatignore": - list = [..RepeatIgnore]; + list = [.. RepeatIgnore]; break; case "callbrotherqqignore": list = CallBrotherQQIgnore.Select(x => x.ToString()).ToList(); diff --git a/src/Settings/OSMCore.cs b/src/Settings/OSMCore.cs index 921a430..57b46f7 100644 --- a/src/Settings/OSMCore.cs +++ b/src/Settings/OSMCore.cs @@ -5,10 +5,10 @@ namespace Milimoe.RainBOT.Settings { public class OSMCore { - public const string version = "v1.0"; - public const string version2 = "Patch12 V1"; + public const string version = "v1.1"; + public const string version2 = "Beta1"; - 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 at {GetBuiltTime(Assembly.GetExecutingAssembly().Location)}\r\nSee: https://github.com/milimoe"; public static string GetBuiltTime(string dll_name) { diff --git a/src/Settings/OshimaController.cs b/src/Settings/OshimaController.cs index 69ac07d..eab5191 100644 --- a/src/Settings/OshimaController.cs +++ b/src/Settings/OshimaController.cs @@ -122,7 +122,7 @@ namespace Milimoe.RainBOT.Settings catch { } } } - + public async Task ConnectToAnonymousServer() { if (HTTPClient != null) @@ -132,7 +132,7 @@ namespace Milimoe.RainBOT.Settings await HTTPClient.Send(SocketMessageType.AnonymousGameServer, ServerName, data); } } - + public async Task DisconnectFromAnonymousServer() { if (HTTPClient != null) @@ -140,7 +140,7 @@ namespace Milimoe.RainBOT.Settings await HTTPClient.Send(SocketMessageType.EndGame); } } - + public async Task DisconnectAsync() { if (HTTPClient != null) diff --git a/src/Settings/RainBOTFunGame.cs b/src/Settings/RainBOTFunGame.cs index a8514c1..ec78e5e 100644 --- a/src/Settings/RainBOTFunGame.cs +++ b/src/Settings/RainBOTFunGame.cs @@ -84,7 +84,7 @@ namespace Milimoe.RainBOT.Settings 32、决斗/完整决斗 <@对方>//<昵称>:和对方切磋 发送【帮助4】查看第 4 页"); } - + if (e.detail == "帮助4") { await Bot.SendGroupMessage(e.group_id, "饭给木", @"《饭给木》游戏指令列表(第 4 / 5 页) @@ -100,7 +100,7 @@ namespace Milimoe.RainBOT.Settings 42、签到:每日签到 发送【帮助5】查看第 5 页"); } - + if (e.detail == "帮助5") { await Bot.SendGroupMessage(e.group_id, "饭给木", @"《饭给木》游戏指令列表(第 5 / 5 页) @@ -381,7 +381,7 @@ namespace Milimoe.RainBOT.Settings } return result; } - + if (e.detail == "我的存档") { string msg = (await Bot.HttpPost($"https://{GeneralSettings.FunGameServer}/fungame/showsaved?uid={e.user_id}", "", fungame: true) ?? "").Trim(); @@ -391,7 +391,7 @@ namespace Milimoe.RainBOT.Settings } return result; } - + if (e.detail == "我的主战") { string msg = (await Bot.HttpPost($"https://{GeneralSettings.FunGameServer}/fungame/showcharacterinfo?uid={e.user_id}&seq=0", "", fungame: true) ?? "").Trim(); @@ -401,7 +401,7 @@ namespace Milimoe.RainBOT.Settings } return result; } - + if (e.detail == "我的状态") { string msg = (await Bot.HttpPost($"https://{GeneralSettings.FunGameServer}/fungame/showmaincharacterorsquadstatus?uid={e.user_id}", "", fungame: true) ?? "").Trim(); @@ -411,7 +411,7 @@ namespace Milimoe.RainBOT.Settings } return result; } - + if (e.detail == "小队状态" || e.detail == "我的小队状态") { string msg = (await Bot.HttpPost($"https://{GeneralSettings.FunGameServer}/fungame/showmaincharacterorsquadstatus?uid={e.user_id}&squad=true", "", fungame: true) ?? "").Trim(); @@ -421,7 +421,7 @@ namespace Milimoe.RainBOT.Settings } return result; } - + if (e.detail == "我的小队") { string msg = (await Bot.HttpPost($"https://{GeneralSettings.FunGameServer}/fungame/showsquad?uid={e.user_id}", "", fungame: true) ?? "").Trim(); @@ -431,7 +431,7 @@ namespace Milimoe.RainBOT.Settings } return result; } - + if (e.detail == "清空小队") { string msg = (await Bot.HttpPost($"https://{GeneralSettings.FunGameServer}/fungame/clearsquad?uid={e.user_id}", "", fungame: true) ?? "").Trim(); @@ -673,7 +673,7 @@ namespace Milimoe.RainBOT.Settings } return result; } - + if (e.detail.Length >= 4 && e.detail[..4].Equals("角色技能", StringComparison.CurrentCultureIgnoreCase)) { string detail = e.detail.Replace("角色技能", "").Trim(); @@ -692,7 +692,7 @@ namespace Milimoe.RainBOT.Settings } return result; } - + if (e.detail.Length >= 4 && e.detail[..4].Equals("角色物品", StringComparison.CurrentCultureIgnoreCase)) { string detail = e.detail.Replace("角色物品", "").Trim(); @@ -779,7 +779,7 @@ namespace Milimoe.RainBOT.Settings } return result; } - + if (e.detail == "任务列表") { string msg = (await Bot.HttpPost($"https://{GeneralSettings.FunGameServer}/fungame/checkquestlist?uid={e.user_id}", "", fungame: true) ?? "").Trim(); @@ -789,7 +789,7 @@ namespace Milimoe.RainBOT.Settings } return result; } - + if (e.detail == "任务信息") { string msg = (await Bot.HttpPost($"https://{GeneralSettings.FunGameServer}/fungame/checkworkingquest?uid={e.user_id}", "", fungame: true) ?? "").Trim(); @@ -799,7 +799,7 @@ namespace Milimoe.RainBOT.Settings } return result; } - + if (e.detail == "任务结算") { string msg = (await Bot.HttpPost($"https://{GeneralSettings.FunGameServer}/fungame/settlequest?uid={e.user_id}", "", fungame: true) ?? "").Trim(); @@ -809,7 +809,7 @@ namespace Milimoe.RainBOT.Settings } return result; } - + if (e.detail == "签到") { string msg = (await Bot.HttpPost($"https://{GeneralSettings.FunGameServer}/fungame/signin?uid={e.user_id}", "", fungame: true) ?? "").Trim(); @@ -819,7 +819,7 @@ namespace Milimoe.RainBOT.Settings } return result; } - + if (e.detail.Length >= 4 && e.detail[..4].Equals("开始任务", StringComparison.CurrentCultureIgnoreCase)) { string detail = e.detail.Replace("开始任务", "").Trim(); @@ -833,7 +833,7 @@ namespace Milimoe.RainBOT.Settings } return result; } - + if (e.detail.Length >= 4 && e.detail[..4].Equals("我的物品", StringComparison.CurrentCultureIgnoreCase)) { string detail = e.detail.Replace("我的物品", "").Trim(); @@ -1337,7 +1337,7 @@ namespace Milimoe.RainBOT.Settings } return result; } - + if (e.detail.Length >= 4 && e.detail[..4].Equals("小队决斗", StringComparison.CurrentCultureIgnoreCase)) { string detail = e.detail.Replace("小队决斗", "").Replace("@", "").Trim(); @@ -1410,7 +1410,7 @@ namespace Milimoe.RainBOT.Settings } return result; } - + if (e.detail.Length >= 8 && e.detail[..8].Equals("小队讨伐boss", StringComparison.CurrentCultureIgnoreCase)) { string detail = e.detail.Replace("小队讨伐boss", "").Trim(); @@ -1464,7 +1464,7 @@ namespace Milimoe.RainBOT.Settings } return result; } - + if (e.detail.Length >= 6 && e.detail[..6].Equals("讨伐boss", StringComparison.CurrentCultureIgnoreCase)) { string detail = e.detail.Replace("讨伐boss", "").Trim(); @@ -1532,7 +1532,7 @@ namespace Milimoe.RainBOT.Settings } return result; } - + if (e.detail.Length >= 4 && e.detail[..4].Equals("小队移除", StringComparison.CurrentCultureIgnoreCase)) { string detail = e.detail.Replace("小队移除", "").Trim(); @@ -1546,7 +1546,7 @@ namespace Milimoe.RainBOT.Settings } return result; } - + if (e.detail.Length >= 4 && (e.detail.StartsWith("设置小队") || e.detail.StartsWith("重组小队"))) { string detail = e.detail.Replace("设置小队", "").Replace("重组小队", "").Trim(); @@ -1580,7 +1580,7 @@ namespace Milimoe.RainBOT.Settings } return result; } - + if (e.detail.Length >= 4 && e.detail[..4].Equals("创建社团", StringComparison.CurrentCultureIgnoreCase)) { string detail = e.detail.Replace("创建社团", "").Trim(); @@ -1607,7 +1607,7 @@ namespace Milimoe.RainBOT.Settings } return result; } - + if (e.detail == "我的社团") { string msg = (await Bot.HttpPost($"https://{GeneralSettings.FunGameServer}/fungame/showclubinfo?uid={e.user_id}", "", fungame: true) ?? "").Trim(); @@ -1627,7 +1627,7 @@ namespace Milimoe.RainBOT.Settings } return result; } - + if (e.detail == "查看社团成员") { string msg = (await Bot.HttpPost($"https://{GeneralSettings.FunGameServer}/fungame/showclubmemberlist?uid={e.user_id}&type=0", "", fungame: true) ?? "").Trim(); @@ -1637,7 +1637,7 @@ namespace Milimoe.RainBOT.Settings } return result; } - + if (e.detail == "查看社团管理") { string msg = (await Bot.HttpPost($"https://{GeneralSettings.FunGameServer}/fungame/showclubmemberlist?uid={e.user_id}&type=1", "", fungame: true) ?? "").Trim(); @@ -1647,7 +1647,7 @@ namespace Milimoe.RainBOT.Settings } return result; } - + if (e.detail == "查看申请人列表") { string msg = (await Bot.HttpPost($"https://{GeneralSettings.FunGameServer}/fungame/showclubmemberlist?uid={e.user_id}&type=2", "", fungame: true) ?? "").Trim(); @@ -1671,7 +1671,7 @@ namespace Milimoe.RainBOT.Settings } return result; } - + if (e.detail.Length >= 4 && e.detail[..4].Equals("社团拒绝", StringComparison.CurrentCultureIgnoreCase)) { string detail = e.detail.Replace("社团拒绝", "").Replace("@", "").Trim(); @@ -1685,7 +1685,7 @@ namespace Milimoe.RainBOT.Settings } return result; } - + if (e.detail.Length >= 4 && e.detail[..4].Equals("社团踢出", StringComparison.CurrentCultureIgnoreCase)) { string detail = e.detail.Replace("社团踢出", "").Replace("@", "").Trim(); @@ -1699,7 +1699,7 @@ namespace Milimoe.RainBOT.Settings } return result; } - + if (e.detail.Length >= 4 && e.detail[..4].Equals("社团设置", StringComparison.CurrentCultureIgnoreCase)) { string detail = e.detail.Replace("社团设置", "").Trim(); diff --git a/src/Settings/SayNo.cs b/src/Settings/SayNo.cs index d2e3006..28dd240 100644 --- a/src/Settings/SayNo.cs +++ b/src/Settings/SayNo.cs @@ -232,7 +232,7 @@ namespace Milimoe.RainBOT.Settings string msg; if (islist) { - msg = list.Count > 0 ? "列表" + part + "拥有以下成员:" + "\r\n"+ string.Join("\r\n", list) : "此列表不存在或没有任何成员。"; + msg = list.Count > 0 ? "列表" + part + "拥有以下成员:" + "\r\n" + string.Join("\r\n", list) : "此列表不存在或没有任何成员。"; } else {