public void ProcessGroupMessage(GroupMessageReceivedContext context) { if (HotUpdateInfo.PreviousVersion) { return; } if (GroupCallDic.ContainsKey(context.FromGroup)) { if (GroupCallDic[context.FromGroup] > Config.Instance.CallperMinute && Config.Instance.CallperMinute != 0) { return; } } else { GroupCallDic[context.FromGroup] = 0; } Task.Factory.StartNew(() => { var message = HttpUtility.HtmlDecode(context.Message)?.ToLower(); if (!message.StartsWith("/") && Config.Instance.IsSlashRequired) { return; } message = message.StartsWith("/") ? message.Substring(1) : message; var handler = new GroupMessageHandler(context.FromQq.ToHumanQQNumber(), context.FromGroup.ToGroupNumber(), message); var(matched, result) = handler.ProcessCommandInput(); }, TaskCreationOptions.LongRunning); }
private static bool CheckCallPerMin(GroupID groupId) { if (GroupCallDic.ContainsKey(groupId)) { if (GroupCallDic[groupId] > Config.Instance.CallperMinute && Config.Instance.CallperMinute != 0) { return(true); } } else { GroupCallDic[groupId] = 0; } return(false); }