Esempio n. 1
0
 public static void CheckMethod()
 {
     while (true)
     {
         Thread.Sleep(CheckSpan);
         lock (_lock)
         {
             Task.Run(async() =>
             {
                 var now  = DateTime.Now;
                 var bots = Program.QQServer.GetBotList();
                 var msgs = await TipMessageService.GetTipMessages(TipMessage.TipTargetType.QQGroup, now);
                 foreach (var msg in msgs)
                 {
                     foreach (var bot in bots)
                     {
                         var api = Program.QQServer.GetSoraApi(bot);
                         if (await api.CheckHasGroup(msg.TargetID))
                         {
                             ConsoleLog.Debug("TipMessage", $"Send tip message to group {msg.TargetID} with bot {bot}");
                             var m = new ArrayList
                             {
                                 "[Tip Message]",
                                 Environment.NewLine
                             };
                             int n = 0;
                             int i = msg.Message.IndexOf("[@all]", n);
                             while (i < msg.Message.Length && i >= n)
                             {
                                 m.Add(msg.Message[n..i]);
                                 m.Add(CQCode.CQAtAll());
                                 i = msg.Message.IndexOf("[@all]", n = i + 6);
                             }
                             m.Add(msg.Message[n..]);