Exemplo n.º 1
0
        /// <summary>
        /// 查询
        /// </summary>
        /// <param name="eventArgs"></param>
        /// <returns></returns>
        public async ValueTask SearchRank(GroupMessageEventArgs eventArgs, UserConfig config)
        {
            var isSign = _signUserServices.QueryById(t => t.QNumber.Equals(eventArgs.SenderInfo.UserId.ObjToString()));

            if (isSign != null)
            {
                await SendMessageGroup(eventArgs, $"{config.ConfigModel.NickName}当前有{isSign.Rank}分,继续努力吧~", true);
            }
            else
            {
                await SendMessageGroup(eventArgs, $"没有找到任何记录噢~请先对{config.ConfigModel.BotName}说签到吧", true);
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// 触发加分
 /// </summary>
 /// <param name="eventArgs"></param>
 /// <param name="userConfig"></param>
 /// <returns></returns>
 private async ValueTask TriggerCute(GroupMessageEventArgs eventArgs, UserConfig userConfig)
 {
     if (new Random().Next(1, 100) is 66)
     {
         var user = _userServices.QueryById(q => q.QNumber == eventArgs.SenderInfo.UserId.ObjToString());
         var rank = new Random().Next(1, 10);
         if (user == null)
         {
             await eventArgs.Reply(CQCode.CQAt(eventArgs.SenderInfo.UserId), $"未找到{userConfig.ConfigModel.NickName}任何记录,奖励下发失败~");
         }
         else
         {
             user.Rank          += rank;
             user.LastModifyTime = DateTime.Now;
             _userServices.Update(user);
             _logsServices.Insert(new SignLogs()
             {
                 CmdType    = CmdType.BonusPoints,
                 LogContent = $"[可爱]指令赠送{rank}分",
                 ModifyRank = rank,
                 Uid        = eventArgs.SenderInfo.UserId.ObjToString()
             });
             await eventArgs.Reply(CQCode.CQAt(eventArgs.SenderInfo.UserId), $"看{userConfig.ConfigModel.NickName}这么可爱,就奖励{userConfig.ConfigModel.NickName}{rank}分~");
         }
     }
 }