Пример #1
0
        public async ValueTask PrivateMessageParse(object sender, PrivateMessageEventArgs eventArgs)
        {
            //配置文件实例
            config = new(eventArgs.LoginUid);
            //读取配置文件
            if (!config.LoadUserConfig(out UserConfig userConfig))
            {
                await eventArgs.Sender.SendPrivateMessage("读取配置文件(User)时发生错误\r\n请检查配置文件然后重启");

                ConsoleLog.Error("Qiushui机器人管理", "无法读取用户配置文件");
                return;
            }

            //人工智障
            //var service = new DealInstruction(ConsoleLog, userConfig);
            var all    = _keyWordServices.Query(t => t.ID > 0);
            var result = _keyWordServices.Query(t => t.Keys.Contains(eventArgs.Message.RawText)) ?? new List <LianKeyWords>();

            if (result.Count > 0 && result != null)
            {
                var strSb = new StringBuilder();
                strSb.Append($"已找到所有符合项:\r\n");
                foreach (var item in result)
                {
                    strSb.Append($"{item.Words}\r\n");
                }
                await eventArgs.Reply(strSb.ToString());
            }
            else
            {
                await eventArgs.Reply("没有找到任何符合要求记录");
            }
            //执行人工智障
            //await eventArgs.Reply("数据密码");
        }
Пример #2
0
 public async System.Threading.Tasks.Task TestMethod2Async()
 {
     try
     {
         //var readResults = OperateExcel.ExcelToDataTable(@"C:\Users\changqing\Desktop\chats.xlsx", "sheet1", true);
         //var listResults = OperateExcel.ToDataList<Input>(readResults);
         //foreach (var item in listResults)
         //{
         //    await lianChatServices.Insert(new Qiushui.Lian.Bot.Models.LianChat()
         //    {
         //        Content = item.Chats
         //    });
         //}
         var t  = lianKeyWordsServices.Query(t => t.Status == Status.Valid);
         var t1 = signUserServices.Query(t => t.Status == Status.Valid);
         var t2 = lianChatServices.Query(t => t.Status == Status.Valid);
         var t3 = signUserServices.Query(t => t.QNumber.Equals("1069430666"));
         signLogsServices.DeleteById(t => t.ID > 0);
         // await signLogsServices.DeleteById(2);
         //var t = await signLogsServices.Query(t => t.ID > 0);
     }
     catch (Exception c)
     {
     }
 }