From 355b463464e3c205450e0b342ad14bd9305bb59a Mon Sep 17 00:00:00 2001 From: chr_ Date: Thu, 18 Jul 2024 09:47:42 +0800 Subject: [PATCH] update --- XinjingdailyBot.Command/AdminCommand.cs | 20 ++++++++++++++++--- .../OptionsSetting.cs | 4 +--- .../Extensions/TaskExtension.cs | 2 +- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/XinjingdailyBot.Command/AdminCommand.cs b/XinjingdailyBot.Command/AdminCommand.cs index bf85be67..712fc06b 100644 --- a/XinjingdailyBot.Command/AdminCommand.cs +++ b/XinjingdailyBot.Command/AdminCommand.cs @@ -122,9 +122,23 @@ public async Task ResponseUserInfo(Message message, string[] args) await _botClient.SendCommandReply(sb.ToString(), message, false, parsemode: ParseMode.Html).ConfigureAwait(false); } + /// + /// 封禁用户 + /// + /// + /// + /// + /// [TextCmd("BAN", EUserRights.AdminCmd, Description = "封禁用户")] public Task ResponseBan(Users dbUser, Message message, string[] args) => ResponseBan(dbUser, message, args, false); + /// + /// 静默封禁用户 + /// + /// + /// + /// + /// [TextCmd("MBAN", EUserRights.AdminCmd, Description = "静默封禁用户")] public Task ResponseMBan(Users dbUser, Message message, string[] args) => ResponseBan(dbUser, message, args, true); @@ -206,7 +220,7 @@ async Task exec() { _logger.LogError(ex, "发送私聊消息失败"); } - + await _botClient.SendTextMessageAsync(channelService.AdminLogChannel, textHelperService.MakeAdminLogText(dbUser, targetUser, EBanType.Ban, reason, message), parseMode: ParseMode.Html).ConfigureAwait(false); var sb = new StringBuilder(); @@ -299,7 +313,7 @@ async Task exec() await _botClient.SendTextMessageAsync(channelService.AdminLogChannel, textHelperService.MakeAdminLogText(dbUser, targetUser, EBanType.UnBan, reason, message), parseMode: ParseMode.Html).ConfigureAwait(false); - + var sb = new StringBuilder(); sb.AppendLine($"成功解封 {targetUser.HtmlUserLink()}"); sb.AppendLine($"操作员 {dbUser.HtmlUserLink()}"); @@ -414,7 +428,7 @@ async Task exec() { _logger.LogError(ex, "发送私聊消息失败"); } - + await _botClient.SendTextMessageAsync(channelService.AdminLogChannel, textHelperService.MakeAdminLogText(dbUser, targetUser, EBanType.Warning, reason, message), parseMode: ParseMode.Html).ConfigureAwait(false); return sb.ToString(); diff --git a/XinjingdailyBot.Infrastructure/OptionsSetting.cs b/XinjingdailyBot.Infrastructure/OptionsSetting.cs index 2c9c850a..0885b709 100644 --- a/XinjingdailyBot.Infrastructure/OptionsSetting.cs +++ b/XinjingdailyBot.Infrastructure/OptionsSetting.cs @@ -1,5 +1,3 @@ -using XinjingdailyBot.Infrastructure.Localization; - namespace XinjingdailyBot.Infrastructure; /// @@ -294,7 +292,7 @@ public sealed record ScheduleOption /// /// 任务计划 /// - public Dictionary Cron { get; set; } = []; + public Dictionary Cron { get; set; } = []; } /// diff --git a/XinjingdailyBot.WebAPI/Extensions/TaskExtension.cs b/XinjingdailyBot.WebAPI/Extensions/TaskExtension.cs index f80347b6..cb17ade1 100644 --- a/XinjingdailyBot.WebAPI/Extensions/TaskExtension.cs +++ b/XinjingdailyBot.WebAPI/Extensions/TaskExtension.cs @@ -51,7 +51,7 @@ public static void AddQuartzSetup(this IServiceCollection services, IConfigurati var jobKey = new JobKey(jobType.Name, group); var tiggerKey = new TriggerKey(jobType.Name + "-Tigger", group); - var schedule = cron.GetValueOrDefault(jobType.Name, jobAttribute.Schedule); + var schedule = cron.GetValueOrDefault(jobType.Name, jobAttribute.Schedule)!; try {