diff --git a/src/NadekoBot/Modules/Administration/Commands/RatelimitCommand.cs b/src/NadekoBot/Modules/Administration/Commands/RatelimitCommand.cs index 5ece6c1d..2a4e111f 100644 --- a/src/NadekoBot/Modules/Administration/Commands/RatelimitCommand.cs +++ b/src/NadekoBot/Modules/Administration/Commands/RatelimitCommand.cs @@ -16,7 +16,7 @@ namespace NadekoBot.Modules.Administration public class RatelimitCommand : NadekoSubmodule { public static ConcurrentDictionary RatelimitingChannels = new ConcurrentDictionary(); - private static Logger _log { get; } + private new static readonly Logger _log; public class Ratelimiter { @@ -65,9 +65,7 @@ namespace NadekoBot.Modules.Administration try { var usrMsg = umsg as IUserMessage; - if (usrMsg == null) - return; - var channel = usrMsg.Channel as ITextChannel; + var channel = usrMsg?.Channel as ITextChannel; if (channel == null || usrMsg.IsAuthor()) return; @@ -91,8 +89,7 @@ namespace NadekoBot.Modules.Administration if (RatelimitingChannels.TryRemove(Context.Channel.Id, out throwaway)) { throwaway.cancelSource.Cancel(); - await Context.Channel.SendConfirmAsync("ℹ️ Slow mode disabled.").ConfigureAwait(false); - return; + await ReplyConfirmLocalized("slowmode_disabled").ConfigureAwait(false); } } @@ -105,7 +102,7 @@ namespace NadekoBot.Modules.Administration if (msg < 1 || perSec < 1 || msg > 100 || perSec > 3600) { - await Context.Channel.SendErrorAsync("⚠️ Invalid parameters."); + await ReplyErrorLocalized("invalid_params").ConfigureAwait(false); return; } var toAdd = new Ratelimiter() @@ -116,8 +113,8 @@ namespace NadekoBot.Modules.Administration }; if(RatelimitingChannels.TryAdd(Context.Channel.Id, toAdd)) { - await Context.Channel.SendConfirmAsync("Slow mode initiated", - $"Users can't send more than `{toAdd.MaxMessages} message(s)` every `{toAdd.PerSeconds} second(s)`.") + await Context.Channel.SendConfirmAsync(GetText("slowmode_init"), + GetText("slowmode_desc", Format.Bold(toAdd.MaxMessages.ToString()), Format.Bold(toAdd.PerSeconds.ToString()))) .ConfigureAwait(false); } } diff --git a/src/NadekoBot/Resources/ResponseStrings.Designer.cs b/src/NadekoBot/Resources/ResponseStrings.Designer.cs index ee7d0001..5ed8eb66 100644 --- a/src/NadekoBot/Resources/ResponseStrings.Designer.cs +++ b/src/NadekoBot/Resources/ResponseStrings.Designer.cs @@ -185,6 +185,15 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to Invalid parameters.. + /// + public static string administration_invalid_params { + get { + return ResourceManager.GetString("administration_invalid_params", resourceCulture); + } + } + /// /// Looks up a localized string similar to {0} has joined {1}. /// @@ -574,6 +583,33 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to Users can't send more than {0} messages every {1} seconds.. + /// + public static string administration_slowmode_desc { + get { + return ResourceManager.GetString("administration_slowmode_desc", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Slow mode disabled.. + /// + public static string administration_slowmode_disabled { + get { + return ResourceManager.GetString("administration_slowmode_disabled", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Slow mode initiated. + /// + public static string administration_slowmode_init { + get { + return ResourceManager.GetString("administration_slowmode_init", resourceCulture); + } + } + /// /// Looks up a localized string similar to soft-banned (kicked). /// diff --git a/src/NadekoBot/Resources/ResponseStrings.resx b/src/NadekoBot/Resources/ResponseStrings.resx index 45a93e60..6bb626c3 100644 --- a/src/NadekoBot/Resources/ResponseStrings.resx +++ b/src/NadekoBot/Resources/ResponseStrings.resx @@ -341,6 +341,9 @@ I will stop forwarding DMs from now on. + + Invalid parameters. + {0} has joined {1} @@ -474,6 +477,15 @@ No rotating playing statuses set. + + Users can't send more than {0} messages every {1} seconds. + + + Slow mode disabled. + + + Slow mode initiated + soft-banned (kicked) PLURAL