qqbot #1

Merged
milimoe merged 8 commits from qqbot into master 2025-08-02 10:45:22 +00:00
2 changed files with 24 additions and 16 deletions
Showing only changes of commit e4a77d5421 - Show all commits

View File

@ -109,11 +109,10 @@ namespace Milimoe.RainBOT.ListeningTask
return quick_reply; return quick_reply;
} }
if (e.detail == "圣人榜") if (e.detail.Contains("圣人榜"))
{ {
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;
_ = OshimaController.Instance.SCList(e.group_id); _ = OshimaController.Instance.SCList(e.group_id);
return quick_reply;
} }
if (e.detail == "查询服务器启动时间") if (e.detail == "查询服务器启动时间")
@ -632,6 +631,7 @@ 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));
int sc = 1;
switch (Random.Shared.Next(4)) switch (Random.Shared.Next(4))
{ {
case 0: case 0:
@ -642,14 +642,16 @@ namespace Milimoe.RainBOT.ListeningTask
break; break;
case 2: case 2:
content.message.Add(new TextMessage(string.Concat(name.AsSpan(pos, name.Length > 0 ? 1 : name.Length), "圣"))); content.message.Add(new TextMessage(string.Concat(name.AsSpan(pos, name.Length > 0 ? 1 : name.Length), "圣")));
sc = 3;
break; break;
case 3: case 3:
default: default:
content.message.Add(new TextMessage(string.Concat(name.AsSpan(pos, name.Length > 0 ? 1 : name.Length), "出"))); content.message.Add(new TextMessage(string.Concat(name.AsSpan(pos, name.Length > 0 ? 1 : name.Length), "出")));
sc = -1;
break; break;
} }
await Bot.SendGroupMessage(e.group_id, "随机叫哥", content, delay * 1000); await Bot.SendGroupMessage(e.group_id, "随机叫哥", content, delay * 1000);
_ = OshimaController.Instance.SCAdd(e.user_id, e.group_id); _ = OshimaController.Instance.SCAdd(e.user_id, e.group_id, sc);
return quick_reply; return quick_reply;
} }
} }

View File

@ -113,7 +113,9 @@ namespace Milimoe.RainBOT.Settings
{ {
if (HTTPClient != null) if (HTTPClient != null)
{ {
await HTTPClient.Send(SocketMessageType.AnonymousGameServer, ServerName); Dictionary<string, object> data = [];
data.Add("access_token", GeneralSettings.FunGameToken);
await HTTPClient.Send(SocketMessageType.AnonymousGameServer, ServerName, data);
} }
} }
@ -166,25 +168,29 @@ namespace Milimoe.RainBOT.Settings
if (data.Count > 0) if (data.Count > 0)
{ {
long qq = NetworkUtility.JsonDeserializeFromDictionary<long>(data, "qq"); long qq = NetworkUtility.JsonDeserializeFromDictionary<long>(data, "qq");
long groupid = NetworkUtility.JsonDeserializeFromDictionary<long>(data, "groupid");
string msg = NetworkUtility.JsonDeserializeFromDictionary<string>(data, "msg") ?? ""; string msg = NetworkUtility.JsonDeserializeFromDictionary<string>(data, "msg") ?? "";
if (msg != "") if (msg != "")
{ {
if (qq > 0) if (qq > 0 && groupid > 0)
{ {
foreach (Group g in Bot.Groups.Where(g => GeneralSettings.FunGameWebSocketGroup.Contains(g.group_id))) await Bot.SendGroupMessageAt(qq, groupid, "匿名服务器消息", msg);
{
Member m = Bot.GetMember(g.group_id, qq);
if (m.user_id == qq)
{
await Bot.SendGroupMessageAt(qq, g.group_id, "FunGame推送", msg);
break;
}
}
} }
else else
{ {
long groupid = NetworkUtility.JsonDeserializeFromDictionary<long>(data, "groupid"); if (qq > 0)
if (groupid > 0 && Bot.Groups.Any(g => g.group_id == groupid)) {
foreach (Group g in Bot.Groups.Where(g => GeneralSettings.FunGameWebSocketGroup.Contains(g.group_id)))
{
Member m = Bot.GetMember(g.group_id, qq);
if (m.user_id == qq)
{
await Bot.SendGroupMessageAt(qq, g.group_id, "FunGame推送", msg);
break;
}
}
}
else if (groupid > 0 && Bot.Groups.Any(g => g.group_id == groupid))
{ {
await Bot.SendGroupMessage(groupid, "匿名服务器消息", msg); await Bot.SendGroupMessage(groupid, "匿名服务器消息", msg);
} }