qqbot #1
@ -109,6 +109,13 @@ namespace Milimoe.RainBOT.ListeningTask
|
|||||||
return quick_reply;
|
return quick_reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (e.detail == "圣人榜")
|
||||||
|
{
|
||||||
|
if (!await Bot.CheckBlackList(true, e.user_id, e.group_id)) return quick_reply;
|
||||||
|
_ = OshimaController.Instance.SCList(e.group_id);
|
||||||
|
return quick_reply;
|
||||||
|
}
|
||||||
|
|
||||||
if (e.detail == "查询服务器启动时间")
|
if (e.detail == "查询服务器启动时间")
|
||||||
{
|
{
|
||||||
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;
|
||||||
@ -454,6 +461,7 @@ namespace Milimoe.RainBOT.ListeningTask
|
|||||||
if (content.message.Count > 0)
|
if (content.message.Count > 0)
|
||||||
{
|
{
|
||||||
await Bot.SendGroupMessage(e.group_id, "随机反驳不", content);
|
await Bot.SendGroupMessage(e.group_id, "随机反驳不", content);
|
||||||
|
_ = OshimaController.Instance.SCAdd(e.user_id, e.group_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (SayNo.TriggerBeforeNo.Any(e.detail.Contains) && GeneralSettings.IsSayNo && e.CheckThrow(GeneralSettings.PSayNo, out dice))
|
else if (SayNo.TriggerBeforeNo.Any(e.detail.Contains) && GeneralSettings.IsSayNo && e.CheckThrow(GeneralSettings.PSayNo, out dice))
|
||||||
@ -507,6 +515,7 @@ namespace Milimoe.RainBOT.ListeningTask
|
|||||||
if (content.message.Count > 0)
|
if (content.message.Count > 0)
|
||||||
{
|
{
|
||||||
await Bot.SendGroupMessage(e.group_id, "随机反驳不", content);
|
await Bot.SendGroupMessage(e.group_id, "随机反驳不", content);
|
||||||
|
_ = OshimaController.Instance.SCAdd(e.user_id, e.group_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (e.detail.Contains("可以") && !e.detail.Contains('不') && e.CheckThrow(GeneralSettings.PSayNo, out dice))
|
else if (e.detail.Contains("可以") && !e.detail.Contains('不') && e.CheckThrow(GeneralSettings.PSayNo, out dice))
|
||||||
@ -515,10 +524,12 @@ namespace Milimoe.RainBOT.ListeningTask
|
|||||||
if (dice < (GeneralSettings.PSayNo / 2))
|
if (dice < (GeneralSettings.PSayNo / 2))
|
||||||
{
|
{
|
||||||
await Bot.SendGroupMessage(e.group_id, "随机反驳不", "可以");
|
await Bot.SendGroupMessage(e.group_id, "随机反驳不", "可以");
|
||||||
|
_ = OshimaController.Instance.SCAdd(e.user_id, e.group_id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await Bot.SendGroupMessage(e.group_id, "随机反驳不", "不可以");
|
await Bot.SendGroupMessage(e.group_id, "随机反驳不", "不可以");
|
||||||
|
_ = OshimaController.Instance.SCAdd(e.user_id, e.group_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (e.detail.Contains('能') && !e.detail.Contains('不') && !SayNo.IgnoreTriggerBeforeCan.Any(e.detail.Contains) && e.CheckThrow(GeneralSettings.PSayNo, out dice))
|
else if (e.detail.Contains('能') && !e.detail.Contains('不') && !SayNo.IgnoreTriggerBeforeCan.Any(e.detail.Contains) && e.CheckThrow(GeneralSettings.PSayNo, out dice))
|
||||||
@ -527,10 +538,12 @@ namespace Milimoe.RainBOT.ListeningTask
|
|||||||
if (dice < (GeneralSettings.PSayNo / 2))
|
if (dice < (GeneralSettings.PSayNo / 2))
|
||||||
{
|
{
|
||||||
await Bot.SendGroupMessage(e.group_id, "随机反驳不", "能");
|
await Bot.SendGroupMessage(e.group_id, "随机反驳不", "能");
|
||||||
|
_ = OshimaController.Instance.SCAdd(e.user_id, e.group_id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await Bot.SendGroupMessage(e.group_id, "随机反驳不", "不能");
|
await Bot.SendGroupMessage(e.group_id, "随机反驳不", "不能");
|
||||||
|
_ = OshimaController.Instance.SCAdd(e.user_id, e.group_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (e.detail.Contains("可能") && !e.detail.Contains('不') && e.CheckThrow(GeneralSettings.PSayNo, out dice))
|
else if (e.detail.Contains("可能") && !e.detail.Contains('不') && e.CheckThrow(GeneralSettings.PSayNo, out dice))
|
||||||
@ -539,21 +552,25 @@ namespace Milimoe.RainBOT.ListeningTask
|
|||||||
if (dice < (GeneralSettings.PSayNo / 2))
|
if (dice < (GeneralSettings.PSayNo / 2))
|
||||||
{
|
{
|
||||||
await Bot.SendGroupMessage(e.group_id, "随机反驳不", "可能");
|
await Bot.SendGroupMessage(e.group_id, "随机反驳不", "可能");
|
||||||
|
_ = OshimaController.Instance.SCAdd(e.user_id, e.group_id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
await Bot.SendGroupMessage(e.group_id, "随机反驳不", "不可能");
|
await Bot.SendGroupMessage(e.group_id, "随机反驳不", "不可能");
|
||||||
|
_ = OshimaController.Instance.SCAdd(e.user_id, e.group_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (e.detail.Contains('要') && !e.detail.Contains('不') && e.CheckThrow(GeneralSettings.PSayNo, out dice))
|
else if (e.detail.Contains('要') && !e.detail.Contains('不') && e.CheckThrow(GeneralSettings.PSayNo, out dice))
|
||||||
{
|
{
|
||||||
Bot.ColorfulCheckPass(sender, "随机反驳不", dice, GeneralSettings.PSayNo);
|
Bot.ColorfulCheckPass(sender, "随机反驳不", dice, GeneralSettings.PSayNo);
|
||||||
await Bot.SendGroupMessage(e.group_id, "随机反驳不", SayNo.SayWantWords[new Random().Next(SayNo.SayWantWords.Count)]);
|
await Bot.SendGroupMessage(e.group_id, "随机反驳不", SayNo.SayWantWords[new Random().Next(SayNo.SayWantWords.Count)]);
|
||||||
|
_ = OshimaController.Instance.SCAdd(e.user_id, e.group_id);
|
||||||
}
|
}
|
||||||
else if (e.detail.Contains('想') && !e.detail.Contains('不') && e.CheckThrow(GeneralSettings.PSayNo, out dice))
|
else if (e.detail.Contains('想') && !e.detail.Contains('不') && e.CheckThrow(GeneralSettings.PSayNo, out dice))
|
||||||
{
|
{
|
||||||
Bot.ColorfulCheckPass(sender, "随机反驳不", dice, GeneralSettings.PSayNo);
|
Bot.ColorfulCheckPass(sender, "随机反驳不", dice, GeneralSettings.PSayNo);
|
||||||
await Bot.SendGroupMessage(e.group_id, "随机反驳不", SayNo.SayThinkWords[new Random().Next(SayNo.SayThinkWords.Count)]);
|
await Bot.SendGroupMessage(e.group_id, "随机反驳不", SayNo.SayThinkWords[new Random().Next(SayNo.SayThinkWords.Count)]);
|
||||||
|
_ = OshimaController.Instance.SCAdd(e.user_id, e.group_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 反向艾特
|
// 反向艾特
|
||||||
@ -587,6 +604,7 @@ namespace Milimoe.RainBOT.ListeningTask
|
|||||||
};
|
};
|
||||||
content.message.Add(new ImageMessage(img));
|
content.message.Add(new ImageMessage(img));
|
||||||
await Bot.SendGroupMessage(e.group_id, "Image", content);
|
await Bot.SendGroupMessage(e.group_id, "Image", content);
|
||||||
|
_ = OshimaController.Instance.SCAdd(e.user_id, e.group_id);
|
||||||
return quick_reply;
|
return quick_reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -599,6 +617,7 @@ namespace Milimoe.RainBOT.ListeningTask
|
|||||||
GroupMessageContent content = new(e.group_id);
|
GroupMessageContent content = new(e.group_id);
|
||||||
content.message.AddRange(e.message);
|
content.message.AddRange(e.message);
|
||||||
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);
|
||||||
return quick_reply;
|
return quick_reply;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -630,6 +649,7 @@ namespace Milimoe.RainBOT.ListeningTask
|
|||||||
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);
|
||||||
return quick_reply;
|
return quick_reply;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -11,11 +11,10 @@ namespace Milimoe.RainBOT.Settings
|
|||||||
public class OshimaController : RunTimeController
|
public class OshimaController : RunTimeController
|
||||||
{
|
{
|
||||||
public static OshimaController Instance { get; set; } = new();
|
public static OshimaController Instance { get; set; } = new();
|
||||||
|
|
||||||
public static FunGameConfig Config { get; set; } = new();
|
public static FunGameConfig Config { get; set; } = new();
|
||||||
|
|
||||||
public static int CurrentRetryTimes { get; set; } = -1;
|
public static int CurrentRetryTimes { get; set; } = -1;
|
||||||
public static int MaxRetryTimes => 10;
|
public static int MaxRetryTimes => 30;
|
||||||
|
public const string ServerName = "oshima.fungame.anonymous";
|
||||||
|
|
||||||
public override bool BeforeConnect(ref string addr, ref int port, ArrayList args)
|
public override bool BeforeConnect(ref string addr, ref int port, ArrayList args)
|
||||||
{
|
{
|
||||||
@ -70,7 +69,7 @@ namespace Milimoe.RainBOT.Settings
|
|||||||
{
|
{
|
||||||
result = await ConnectAsync(TransmittalType.WebSocket, GeneralSettings.FunGameServer, ssl: true, subUrl: "ws");
|
result = await ConnectAsync(TransmittalType.WebSocket, GeneralSettings.FunGameServer, ssl: true, subUrl: "ws");
|
||||||
Config.FunGame_isRetrying = false;
|
Config.FunGame_isRetrying = false;
|
||||||
await Task.Delay(2000);
|
await Task.Delay(5000);
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (Exception e)
|
||||||
{
|
{
|
||||||
@ -98,7 +97,7 @@ namespace Milimoe.RainBOT.Settings
|
|||||||
Console.WriteLine("重连失败!");
|
Console.WriteLine("重连失败!");
|
||||||
if (!Config.FunGame_isRetrying && Config.FunGame_isAutoRetry)
|
if (!Config.FunGame_isRetrying && Config.FunGame_isAutoRetry)
|
||||||
{
|
{
|
||||||
await Task.Delay(2000);
|
await Task.Delay(5000);
|
||||||
if (!Config.FunGame_isRetrying && Config.FunGame_isAutoRetry)
|
if (!Config.FunGame_isRetrying && Config.FunGame_isAutoRetry)
|
||||||
{
|
{
|
||||||
await Retry();
|
await Retry();
|
||||||
@ -114,7 +113,7 @@ namespace Milimoe.RainBOT.Settings
|
|||||||
{
|
{
|
||||||
if (HTTPClient != null)
|
if (HTTPClient != null)
|
||||||
{
|
{
|
||||||
await HTTPClient.Send(SocketMessageType.AnonymousGameServer, "oshima.fungame.anonymous");
|
await HTTPClient.Send(SocketMessageType.AnonymousGameServer, ServerName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -143,7 +142,7 @@ namespace Milimoe.RainBOT.Settings
|
|||||||
{
|
{
|
||||||
CurrentRetryTimes = -1;
|
CurrentRetryTimes = -1;
|
||||||
Config.FunGame_isAutoRetry = true;
|
Config.FunGame_isAutoRetry = true;
|
||||||
await Task.Delay(2000);
|
await Task.Delay(5000);
|
||||||
if (!Config.FunGame_isRetrying && Config.FunGame_isAutoRetry)
|
if (!Config.FunGame_isRetrying && Config.FunGame_isAutoRetry)
|
||||||
{
|
{
|
||||||
await Retry();
|
await Retry();
|
||||||
@ -168,7 +167,9 @@ namespace Milimoe.RainBOT.Settings
|
|||||||
{
|
{
|
||||||
long qq = NetworkUtility.JsonDeserializeFromDictionary<long>(data, "qq");
|
long qq = NetworkUtility.JsonDeserializeFromDictionary<long>(data, "qq");
|
||||||
string msg = NetworkUtility.JsonDeserializeFromDictionary<string>(data, "msg") ?? "";
|
string msg = NetworkUtility.JsonDeserializeFromDictionary<string>(data, "msg") ?? "";
|
||||||
if (qq > 0 && msg != "")
|
if (msg != "")
|
||||||
|
{
|
||||||
|
if (qq > 0)
|
||||||
{
|
{
|
||||||
foreach (Group g in Bot.Groups.Where(g => GeneralSettings.FunGameWebSocketGroup.Contains(g.group_id)))
|
foreach (Group g in Bot.Groups.Where(g => GeneralSettings.FunGameWebSocketGroup.Contains(g.group_id)))
|
||||||
{
|
{
|
||||||
@ -180,6 +181,39 @@ namespace Milimoe.RainBOT.Settings
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
long groupid = NetworkUtility.JsonDeserializeFromDictionary<long>(data, "groupid");
|
||||||
|
if (groupid > 0 && Bot.Groups.Any(g => g.group_id == groupid))
|
||||||
|
{
|
||||||
|
await Bot.SendGroupMessage(groupid, "匿名服务器消息", msg);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task SCAdd(long qq, long groupid, double sc = 1)
|
||||||
|
{
|
||||||
|
if (HTTPClient != null)
|
||||||
|
{
|
||||||
|
Dictionary<string, object> data = [];
|
||||||
|
data.Add("command", "scadd");
|
||||||
|
data.Add("qq", qq);
|
||||||
|
data.Add("groupid", groupid);
|
||||||
|
data.Add("sc", sc);
|
||||||
|
await HTTPClient.Send(SocketMessageType.AnonymousGameServer, ServerName, data);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task SCList(long groupid)
|
||||||
|
{
|
||||||
|
if (HTTPClient != null)
|
||||||
|
{
|
||||||
|
Dictionary<string, object> data = [];
|
||||||
|
data.Add("command", "sclist");
|
||||||
|
data.Add("groupid", groupid);
|
||||||
|
await HTTPClient.Send(SocketMessageType.AnonymousGameServer, ServerName, data);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user