代码清理

This commit is contained in:
milimoe 2025-11-17 22:16:52 +08:00
parent 1582fb0eb3
commit 45ad0e3b47
Signed by: milimoe
GPG Key ID: 9554D37E4B8991D0
8 changed files with 50 additions and 51 deletions

View File

@ -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;

View File

@ -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<IContent> 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<T>(content);
return result;
}
public static async Task<T?> HttpPost<T>(string url, string json = "", bool fungame = false)
{
HttpContent content = new StringContent(json, Encoding.UTF8, "application/json");

View File

@ -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<long> SayNoAccessGroup { get; set; } = [];
public static List<long> OSMCoreGroup { get; set; } = [];
public static List<long> FunGameGroup { get; set; } = [];
public static List<long> 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");

View File

@ -16,7 +16,7 @@ namespace Milimoe.RainBOT.Settings
public static List<long> RepeatQQIgnore { 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");
@ -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();

View File

@ -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)
{

View File

@ -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)

View File

@ -84,7 +84,7 @@ namespace Milimoe.RainBOT.Settings
32/ <@>/<QQ号>/<>
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<string>($"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<string>($"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<string>($"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<string>($"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<string>($"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<string>($"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<string>($"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<string>($"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<string>($"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<string>($"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<string>($"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<string>($"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<string>($"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<string>($"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();

View File

@ -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
{