diff --git a/src/NadekoBot/Modules/CustomReactions/NadekoExpressions.cs b/src/NadekoBot/Modules/CustomReactions/NadekoExpressions.cs index eb263a63e..518e809c2 100644 --- a/src/NadekoBot/Modules/CustomReactions/NadekoExpressions.cs +++ b/src/NadekoBot/Modules/CustomReactions/NadekoExpressions.cs @@ -1,7 +1,5 @@ #nullable disable -using Nadeko.Common; - namespace NadekoBot.Modules.NadekoExpressions; [Name("Expressions")] @@ -25,15 +23,10 @@ public partial class NadekoExpressions : NadekoModule => (ctx.Guild is null && _creds.IsOwner(ctx.User)) || (ctx.Guild is not null && ((IGuildUser)ctx.User).GuildPermissions.Administrator); - [Cmd] - public async Task ExprAdd(string key, [Leftover] string message) + private async Task ExprAddInternalAsync(string key, string message) { if (string.IsNullOrWhiteSpace(message) || string.IsNullOrWhiteSpace(key)) - return; - - if (!AdminInGuildOrOwnerInDm()) { - await ReplyErrorLocalizedAsync(strs.expr_insuff_perms); return; } @@ -48,12 +41,43 @@ public partial class NadekoExpressions : NadekoModule message.Length > 1024 ? GetText(strs.redacted_too_long) : message)); } + [Cmd] + [UserPerm(GuildPerm.Administrator)] + public async Task ExprAddServer(string key, [Leftover] string message) + { + if (string.IsNullOrWhiteSpace(message) || string.IsNullOrWhiteSpace(key)) + { + return; + } + + await ExprAddInternalAsync(key, message); + } + + [Cmd] + public async Task ExprAdd(string key, [Leftover] string message) + { + if (string.IsNullOrWhiteSpace(message) || string.IsNullOrWhiteSpace(key)) + { + return; + } + + if (!AdminInGuildOrOwnerInDm()) + { + await ReplyErrorLocalizedAsync(strs.expr_insuff_perms); + return; + } + + await ExprAddInternalAsync(key, message); + } + [Cmd] public async Task ExprEdit(kwum id, [Leftover] string message) { var channel = ctx.Channel as ITextChannel; if (string.IsNullOrWhiteSpace(message) || id < 0) + { return; + } if ((channel is null && !_creds.IsOwner(ctx.User)) || (channel is not null && !((IGuildUser)ctx.User).GuildPermissions.Administrator)) @@ -74,7 +98,9 @@ public partial class NadekoExpressions : NadekoModule message.Length > 1024 ? GetText(strs.redacted_too_long) : message)); } else + { await ReplyErrorLocalizedAsync(strs.expr_no_found_id); + } } [Cmd] @@ -82,7 +108,9 @@ public partial class NadekoExpressions : NadekoModule public async Task ExprList(int page = 1) { if (--page < 0 || page > 999) + { return; + } var expressions = _service.GetExpressionsFor(ctx.Guild?.Id); @@ -153,7 +181,9 @@ public partial class NadekoExpressions : NadekoModule .AddField(GetText(strs.response), ex.Response.TrimTo(1024))); } else + { await ReplyErrorLocalizedAsync(strs.expr_no_found_id); + } } [Cmd] @@ -192,7 +222,9 @@ public partial class NadekoExpressions : NadekoModule succ.Add(emojiStr); if (succ.Count >= 3) + { break; + } } catch { } } @@ -336,4 +368,4 @@ public partial class NadekoExpressions : NadekoModule await ctx.OkAsync(); } -} +} \ No newline at end of file diff --git a/src/NadekoBot/Modules/Utility/Quote/QuoteService.cs b/src/NadekoBot/Modules/Utility/Quote/QuoteService.cs index 7e247d7c2..1ea147733 100644 --- a/src/NadekoBot/Modules/Utility/Quote/QuoteService.cs +++ b/src/NadekoBot/Modules/Utility/Quote/QuoteService.cs @@ -14,7 +14,7 @@ public sealed class QuoteService : IQuoteService, INService { _db = db; } - + /// /// Delete all quotes created by the author in a guild /// diff --git a/src/NadekoBot/data/aliases.yml b/src/NadekoBot/data/aliases.yml index 4c7092b00..639eed75e 100644 --- a/src/NadekoBot/data/aliases.yml +++ b/src/NadekoBot/data/aliases.yml @@ -37,7 +37,7 @@ boost: boostmsg: - boostmsg boostdel: - - boostdel + - boostde logserver: - logserver logignore: @@ -1287,6 +1287,11 @@ expradd: - exadd - exa - acr +expraddserver: + - expradds + - exadds + - exas + - expraddserver exprlist: - exprlist - exl diff --git a/src/NadekoBot/data/bot.yml b/src/NadekoBot/data/bot.yml index e3d842988..8eed650eb 100644 --- a/src/NadekoBot/data/bot.yml +++ b/src/NadekoBot/data/bot.yml @@ -1,5 +1,5 @@ # DO NOT CHANGE -version: 3 +version: 4 # Most commands, when executed, have a small colored line # next to the response. The color depends whether the command # is completed, errored or in progress (pending) @@ -18,6 +18,8 @@ defaultLocale: en-US # Style in which executed commands will show up in the console. # Allowed values: Simple, Normal, None consoleOutputType: Normal +# Whether the bot will check for new releases every hour +checkForUpdates: true # Do you want any messages sent by users in Bot's DM to be forwarded to the owner(s)? forwardMessages: false # Do you want the message to be forwarded only to the first owner specified in the list of owners (in creds.yml), diff --git a/src/NadekoBot/data/strings/commands/commands.en-US.yml b/src/NadekoBot/data/strings/commands/commands.en-US.yml index d61adf4a3..20af429ed 100644 --- a/src/NadekoBot/data/strings/commands/commands.en-US.yml +++ b/src/NadekoBot/data/strings/commands/commands.en-US.yml @@ -197,7 +197,11 @@ iamnot: args: - "Gamer" expradd: - desc: "Add an expression with a trigger and a response. Running this command in server requires the Administration permission. Running this command in DM is Bot Owner only and adds a new global expression. Guide here: " + desc: "Add an expression with a trigger and a response. Bot will post a response whenever someone types the trigger word. Running this command in server requires the Administration permission. Running this command in DM is Bot Owner only and adds a new global expression. Guide here: " + args: + - "\"hello\" Hi there %user.mention%" +expraddserver: + desc: "Add an expression with a trigger and a response in this server. Bot will post a response whenever someone types the trigger word. Guide here: " args: - "\"hello\" Hi there %user.mention%" exprlist: