Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
chr233 committed Jul 18, 2024
1 parent 2ce9a66 commit 355b463
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 7 deletions.
20 changes: 17 additions & 3 deletions XinjingdailyBot.Command/AdminCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,23 @@ public async Task ResponseUserInfo(Message message, string[] args)
await _botClient.SendCommandReply(sb.ToString(), message, false, parsemode: ParseMode.Html).ConfigureAwait(false);
}

/// <summary>
/// 封禁用户
/// </summary>
/// <param name="dbUser"></param>
/// <param name="message"></param>
/// <param name="args"></param>
/// <returns></returns>
[TextCmd("BAN", EUserRights.AdminCmd, Description = "封禁用户")]
public Task ResponseBan(Users dbUser, Message message, string[] args) => ResponseBan(dbUser, message, args, false);

/// <summary>
/// 静默封禁用户
/// </summary>
/// <param name="dbUser"></param>
/// <param name="message"></param>
/// <param name="args"></param>
/// <returns></returns>
[TextCmd("MBAN", EUserRights.AdminCmd, Description = "静默封禁用户")]
public Task ResponseMBan(Users dbUser, Message message, string[] args) => ResponseBan(dbUser, message, args, true);

Expand Down Expand Up @@ -206,7 +220,7 @@ async Task<string> 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();
Expand Down Expand Up @@ -299,7 +313,7 @@ async Task<string> 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()}");
Expand Down Expand Up @@ -414,7 +428,7 @@ async Task<string> 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();
Expand Down
4 changes: 1 addition & 3 deletions XinjingdailyBot.Infrastructure/OptionsSetting.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using XinjingdailyBot.Infrastructure.Localization;

namespace XinjingdailyBot.Infrastructure;

/// <summary>
Expand Down Expand Up @@ -294,7 +292,7 @@ public sealed record ScheduleOption
/// <summary>
/// 任务计划
/// </summary>
public Dictionary<string, string> Cron { get; set; } = [];
public Dictionary<string, string?> Cron { get; set; } = [];
}

/// <summary>
Expand Down
2 changes: 1 addition & 1 deletion XinjingdailyBot.WebAPI/Extensions/TaskExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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
{
Expand Down

0 comments on commit 355b463

Please sign in to comment.