From 8dca94822400df59f19ae6d573c648557f19047a Mon Sep 17 00:00:00 2001 From: Kwoth Date: Thu, 22 Dec 2022 21:18:26 +0100 Subject: [PATCH] Fixed some build warnings. Fixed TimeOut punishment not allowing duration --- .../Protection/ProtectionService.cs | 1 + .../Administration/Self/DoAsUserMessage.cs | 22 +++++++++---------- .../ServerLog/ServerLogCommandService.cs | 3 ++- 3 files changed, 14 insertions(+), 12 deletions(-) diff --git a/src/NadekoBot/Modules/Administration/Protection/ProtectionService.cs b/src/NadekoBot/Modules/Administration/Protection/ProtectionService.cs index 5cb61204d..345b089cb 100644 --- a/src/NadekoBot/Modules/Administration/Protection/ProtectionService.cs +++ b/src/NadekoBot/Modules/Administration/Protection/ProtectionService.cs @@ -457,6 +457,7 @@ public class ProtectionService : INService case PunishmentAction.ChatMute: case PunishmentAction.VoiceMute: case PunishmentAction.AddRole: + case PunishmentAction.TimeOut: return true; default: return false; diff --git a/src/NadekoBot/Modules/Administration/Self/DoAsUserMessage.cs b/src/NadekoBot/Modules/Administration/Self/DoAsUserMessage.cs index 1a65f0985..849c7df3a 100644 --- a/src/NadekoBot/Modules/Administration/Self/DoAsUserMessage.cs +++ b/src/NadekoBot/Modules/Administration/Self/DoAsUserMessage.cs @@ -19,38 +19,38 @@ public sealed class DoAsUserMessage : IUserMessage public DateTimeOffset CreatedAt => _msg.CreatedAt; - public Task DeleteAsync(RequestOptions options = null) + public Task DeleteAsync(RequestOptions? options = null) { return _msg.DeleteAsync(options); } - public Task AddReactionAsync(IEmote emote, RequestOptions options = null) + public Task AddReactionAsync(IEmote emote, RequestOptions? options = null) { return _msg.AddReactionAsync(emote, options); } - public Task RemoveReactionAsync(IEmote emote, IUser user, RequestOptions options = null) + public Task RemoveReactionAsync(IEmote emote, IUser user, RequestOptions? options = null) { return _msg.RemoveReactionAsync(emote, user, options); } - public Task RemoveReactionAsync(IEmote emote, ulong userId, RequestOptions options = null) + public Task RemoveReactionAsync(IEmote emote, ulong userId, RequestOptions? options = null) { return _msg.RemoveReactionAsync(emote, userId, options); } - public Task RemoveAllReactionsAsync(RequestOptions options = null) + public Task RemoveAllReactionsAsync(RequestOptions? options = null) { return _msg.RemoveAllReactionsAsync(options); } - public Task RemoveAllReactionsForEmoteAsync(IEmote emote, RequestOptions options = null) + public Task RemoveAllReactionsForEmoteAsync(IEmote emote, RequestOptions? options = null) { return _msg.RemoveAllReactionsForEmoteAsync(emote, options); } public IAsyncEnumerable> GetReactionUsersAsync(IEmote emoji, int limit, - RequestOptions options = null) + RequestOptions? options = null) { return _msg.GetReactionUsersAsync(emoji, limit, options); } @@ -107,22 +107,22 @@ public sealed class DoAsUserMessage : IUserMessage public IMessageInteraction Interaction => _msg.Interaction; - public Task ModifyAsync(Action func, RequestOptions options = null) + public Task ModifyAsync(Action func, RequestOptions? options = null) { return _msg.ModifyAsync(func, options); } - public Task PinAsync(RequestOptions options = null) + public Task PinAsync(RequestOptions? options = null) { return _msg.PinAsync(options); } - public Task UnpinAsync(RequestOptions options = null) + public Task UnpinAsync(RequestOptions? options = null) { return _msg.UnpinAsync(options); } - public Task CrosspostAsync(RequestOptions options = null) + public Task CrosspostAsync(RequestOptions? options = null) { return _msg.CrosspostAsync(options); } diff --git a/src/NadekoBot/Modules/Administration/ServerLog/ServerLogCommandService.cs b/src/NadekoBot/Modules/Administration/ServerLog/ServerLogCommandService.cs index f2e39b1b1..b37d5858a 100644 --- a/src/NadekoBot/Modules/Administration/ServerLog/ServerLogCommandService.cs +++ b/src/NadekoBot/Modules/Administration/ServerLog/ServerLogCommandService.cs @@ -90,7 +90,7 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor _punishService.OnUserWarned += PunishServiceOnOnUserWarned; } - private async Task _client_ThreadDeleted(Cacheable sch) + private Task _client_ThreadDeleted(Cacheable sch) { _ = Task.Run(async () => { @@ -120,6 +120,7 @@ public sealed class LogCommandService : ILogCommandService, IReadyExecutor // ignored } }); + return Task.CompletedTask; } private Task _client_ThreadCreated(SocketThreadChannel sch)