一些升级

This commit is contained in:
milimoe 2026-04-27 21:54:04 +08:00
parent 0c90b77878
commit 8eaddeb5c6
Signed by: milimoe
GPG Key ID: 9554D37E4B8991D0
5 changed files with 107 additions and 14 deletions

View File

@ -396,6 +396,35 @@ namespace Milimoe.RainBOT.Command
SendMessage(send_group, target_id, "OSM Core此命令仅允许在群聊中使用。");
}
}
else if (command.Contains(".osm api"))
{
TaskUtility.NewTask(async () =>
{
if (!await Bot.CheckBlackList(send_group, user_id, target_id))
{
return;
}
string str = command.Replace(".osm api", "").Trim();
if (OpenGetRequest.OpenGetRequestList.TryGetValue(str, out string? api) && api != null)
{
if (str == "烂梗")
{
dynamic? result = await Bot.HttpGet<dynamic>(api);
string barrage = OpenGetRequest.GetMeme(result);
SendMessage(send_group, target_id, barrage);
}
else
{
string result = await Bot.HttpGet<string>(api) ?? "";
SendMessage(send_group, target_id, result);
}
}
else
{
SendMessage(send_group, target_id, "尚未记录该 API 用法。");
}
});
}
else
{
SendMessage(send_group, target_id, Execute_Worker(".osm missingcommand", ""));

View File

@ -113,13 +113,14 @@ namespace Milimoe.RainBOT.ListeningTask
{
await Bot.SendMessage(SupportedAPI.delete_msg, e.group_id, "撤回", new DeleteMsgContent(e.message_id), true);
await Bot.SendMessage(SupportedAPI.set_group_ban, e.group_id, "禁言", new SetGroupBanContent(e.group_id, e.user_id, 120), true);
await OshimaController.Instance.SCAdd(e.user_id, e.group_id, "违禁词惩罚", -2);
return quick_reply;
}
if (e.detail.Contains("年度圣人"))
{
if (!await Bot.CheckBlackList(true, e.user_id, e.group_id)) return quick_reply;
_ = OshimaController.Instance.SCList_WS(e.group_id, e.user_id);
await Bot.SendGroupMessage(e.group_id, "圣人榜", "暂不开放查询");
return quick_reply;
}
@ -133,30 +134,60 @@ namespace Milimoe.RainBOT.ListeningTask
if (e.detail.Contains("月度圣人"))
{
if (!await Bot.CheckBlackList(true, e.user_id, e.group_id)) return quick_reply;
//_ = OshimaController.Instance.SCList_Backup(e.group_id, e.user_id);
await Bot.SendGroupMessage(e.group_id, "圣人榜", "暂不开放查询");
int year = DateTime.Today.Year;
int month = DateTime.Today.Month;
if (month == 1)
{
month = 12;
year -= 1;
}
else
{
month -= 1;
}
await Bot.SendGroupMessage(e.group_id, "圣人榜", await OshimaController.Instance.SCList(e.group_id, e.user_id, false, year, month));
return quick_reply;
}
if (e.detail.Contains("月度出生"))
{
if (!await Bot.CheckBlackList(true, e.user_id, e.group_id)) return quick_reply;
//_ = OshimaController.Instance.SCList_Backup(e.group_id, e.user_id, true);
await Bot.SendGroupMessage(e.group_id, "圣人榜", "暂不开放查询");
int year = DateTime.Today.Year;
int month = DateTime.Today.Month;
if (month == 1)
{
month = 12;
year -= 1;
}
else
{
month -= 1;
}
await Bot.SendGroupMessage(e.group_id, "圣人榜", await OshimaController.Instance.SCList(e.group_id, e.user_id, true, year, month));
return quick_reply;
}
if (e.detail.Contains("圣人榜"))
{
if (!await Bot.CheckBlackList(true, e.user_id, e.group_id)) return quick_reply;
await Bot.SendGroupMessage(e.group_id, "圣人榜", await OshimaController.Instance.SCList(e.group_id, e.user_id));
int? m = null;
if (int.TryParse(e.detail.Replace("圣人榜", ""), out int temp) && temp >= 1 && temp <= 12)
{
m = temp;
}
await Bot.SendGroupMessage(e.group_id, "圣人榜", await OshimaController.Instance.SCList(e.group_id, e.user_id, m: m));
return quick_reply;
}
if (e.detail.Contains("出生榜"))
{
if (!await Bot.CheckBlackList(true, e.user_id, e.group_id)) return quick_reply;
await Bot.SendGroupMessage(e.group_id, "圣人榜", await OshimaController.Instance.SCList(e.group_id, e.user_id, true));
int? m = null;
if (int.TryParse(e.detail.Replace("出生榜", ""), out int temp) && temp >= 1 && temp <= 12)
{
m = temp;
}
await Bot.SendGroupMessage(e.group_id, "圣人榜", await OshimaController.Instance.SCList(e.group_id, e.user_id, true, m: m));
return quick_reply;
}
@ -473,7 +504,7 @@ namespace Milimoe.RainBOT.ListeningTask
if (e.CheckThrow(30, out _) && OpenGetRequest.OpenGetRequestList.TryGetValue("烂梗", out string? url) && url?.Length > 0)
{
dynamic? result = await Bot.HttpGet<dynamic>(url);
string barrage = result?.GetProperty("data").GetProperty("barrage").GetString() ?? "";
string barrage = OpenGetRequest.GetMeme(result);
content.message.Add(new TextMessage(barrage));
}
else
@ -764,7 +795,11 @@ namespace Milimoe.RainBOT.ListeningTask
{
if (qq == GeneralSettings.Master) title = "米莉";
else if (qq == GeneralSettings.BotQQ) title = "小雪";
else title = Bot.GetMemberTitle(e.group_id, qq);
else
{
title = Bot.GetMemberTitle(e.group_id, qq);
if (title == "No.18") title = "小音";
}
}
AI.Add(e.user_id == GeneralSettings.Master ? "米莉" : e.sender.title, (title != "" ? $"@{title} " : "") + string.Join("", e.message.Where(m => m.type == "text").Select(s => s.data.ToString())));
if (!AI.CD && (isAt || e.detail.StartsWith("小雪") || AI.Count > 4))

View File

@ -72,7 +72,29 @@ namespace Milimoe.RainBOT.Settings
4
++
...
怀
稿
穿cos静物石膏吗
-
西
穿
穿72
///使
@ -190,7 +212,7 @@ namespace Milimoe.RainBOT.Settings
public class ChatRequest
{
public string Model { get; set; } = "deepseek-chat";
public string Model { get; set; } = "deepseek-v4-flash";
public List<ChatRequestMessage> Messages { get; set; } = [];
public bool Stream { get; set; } = false;
public int MaxTokens { get; set; } = 50;

View File

@ -19,5 +19,10 @@ namespace Milimoe.RainBOT.Settings
}
}
}
public static string GetMeme(dynamic? result)
{
return result?.GetProperty("data").GetProperty("barrage").GetString() ?? "";
}
}
}

View File

@ -24,7 +24,7 @@ namespace Milimoe.RainBOT.Settings
Console.WriteLine("正在连接服务器,请耐心等待。");
return false;
}
string[] strings = ["milimoe.com.anonymous"];
string[] strings = ["milimoe.com.anonymous", "milimoe.com.map"];
args.Add(strings);
args.Add(false);
if (!Config.FunGame_isConnected)
@ -232,7 +232,7 @@ namespace Milimoe.RainBOT.Settings
{
HTTPClient.Instance.DefaultRequestHeaders.Clear();
HTTPClient.Instance.DefaultRequestHeaders.Add("Authorization", $"Bearer {GeneralSettings.FunGameToken}");
await HTTPClient.HttpPost<string>($"http://{GeneralSettings.FunGameServer2}/api/scadd", NetworkUtility.JsonSerialize(new
await HTTPClient.HttpPost($"http://{GeneralSettings.FunGameServer2}/api/scadd", NetworkUtility.JsonSerialize(new
{
UID = qq,
Group = groupid,
@ -262,7 +262,7 @@ namespace Milimoe.RainBOT.Settings
}
}
public async Task<string> SCList(long groupid, long qq, bool reverse = false)
public async Task<string> SCList(long groupid, long qq, bool reverse = false, int? y = null, int? m = null)
{
if (HTTPClient != null)
{
@ -270,7 +270,9 @@ namespace Milimoe.RainBOT.Settings
HTTPClient.Instance.DefaultRequestHeaders.Add("Authorization", $"Bearer {GeneralSettings.FunGameToken}");
DateTime today = DateTime.Today;
int year = today.Year;
if (y != null) year = y.Value;
int month = today.Month;
if (m != null) month = m.Value;
return await HTTPClient.HttpGet<string>($"http://{GeneralSettings.FunGameServer2}/api/sclist?id={qq}&group={groupid}&year={year}&month={month}&reverse={reverse}") ?? "";
}
return "服务器繁忙,请稍后再试。";