diff --git a/src/NadekoBot/Modules/Administration/Commands/ServerGreetCommands.cs b/src/NadekoBot/Modules/Administration/Commands/ServerGreetCommands.cs index 787058d5..e5667239 100644 --- a/src/NadekoBot/Modules/Administration/Commands/ServerGreetCommands.cs +++ b/src/NadekoBot/Modules/Administration/Commands/ServerGreetCommands.cs @@ -12,6 +12,7 @@ namespace NadekoBot.Modules.Administration { public partial class Administration { + [Group] public class ServerGreetCommands { public static long Greeted = 0; @@ -113,28 +114,6 @@ namespace NadekoBot.Modules.Administration await channel.SendMessageAsync("`Automatic deletion of greet messages has been disabled.`").ConfigureAwait(false); } - [LocalizedCommand, LocalizedDescription, LocalizedSummary] - [RequireContext(ContextType.Guild)] - [RequirePermission(GuildPermission.ManageGuild)] - public async Task ByeDel(IMessage imsg) - { - var channel = (ITextChannel)imsg.Channel; - - GuildConfig conf; - using (var uow = DbHandler.UnitOfWork()) - { - conf = uow.GuildConfigs.For(channel.Guild.Id); - conf.AutoDeleteByeMessages = !conf.AutoDeleteByeMessages; - uow.GuildConfigs.Update(conf); - await uow.CompleteAsync(); - } - - if (conf.AutoDeleteByeMessages) - await channel.SendMessageAsync("`Automatic deletion of bye messages has been enabled.`").ConfigureAwait(false); - else - await channel.SendMessageAsync("`Automatic deletion of bye messages has been disabled.`").ConfigureAwait(false); - } - [LocalizedCommand, LocalizedDescription, LocalizedSummary] [RequireContext(ContextType.Guild)] [RequirePermission(GuildPermission.ManageGuild)] @@ -157,31 +136,10 @@ namespace NadekoBot.Modules.Administration else await channel.SendMessageAsync("Greet announcements disabled.").ConfigureAwait(false); } - + [LocalizedCommand, LocalizedDescription, LocalizedSummary] [RequireContext(ContextType.Guild)] [RequirePermission(GuildPermission.ManageGuild)] - public async Task DmGreet(IMessage imsg) - { - var channel = (ITextChannel)imsg.Channel; - - GuildConfig conf; - using (var uow = DbHandler.UnitOfWork()) - { - conf = uow.GuildConfigs.For(channel.Guild.Id); - conf.SendDmGreetMessage = !conf.SendDmGreetMessage; - uow.GuildConfigs.Update(conf); - await uow.CompleteAsync(); - } - - if (conf.SendDmGreetMessage) - await channel.SendMessageAsync("Greet announcements enabled on this channel.").ConfigureAwait(false); - else - await channel.SendMessageAsync("Greet announcements disabled.").ConfigureAwait(false); - } - - [LocalizedCommand, LocalizedDescription, LocalizedSummary] - [RequireContext(ContextType.Guild)] public async Task GreetMsg(IMessage imsg, [Remainder] string text) { var channel = (ITextChannel)imsg.Channel; @@ -210,7 +168,30 @@ namespace NadekoBot.Modules.Administration [LocalizedCommand, LocalizedDescription, LocalizedSummary] [RequireContext(ContextType.Guild)] - public async Task DmGreetMsg(IMessage imsg, [Remainder] string text) + [RequirePermission(GuildPermission.ManageGuild)] + public async Task GreetDm(IMessage imsg) + { + var channel = (ITextChannel)imsg.Channel; + + GuildConfig conf; + using (var uow = DbHandler.UnitOfWork()) + { + conf = uow.GuildConfigs.For(channel.Guild.Id); + conf.SendDmGreetMessage = !conf.SendDmGreetMessage; + uow.GuildConfigs.Update(conf); + await uow.CompleteAsync(); + } + + if (conf.SendDmGreetMessage) + await channel.SendMessageAsync("Greet announcements enabled on this channel.").ConfigureAwait(false); + else + await channel.SendMessageAsync("Greet announcements disabled.").ConfigureAwait(false); + } + + [LocalizedCommand, LocalizedDescription, LocalizedSummary] + [RequireContext(ContextType.Guild)] + [RequirePermission(GuildPermission.ManageGuild)] + public async Task GreetDmMsg(IMessage imsg, [Remainder] string text) { var channel = (ITextChannel)imsg.Channel; @@ -261,6 +242,7 @@ namespace NadekoBot.Modules.Administration [LocalizedCommand, LocalizedDescription, LocalizedSummary] [RequireContext(ContextType.Guild)] + [RequirePermission(GuildPermission.ManageGuild)] public async Task ByeMsg(IMessage imsg, [Remainder] string text) { var channel = (ITextChannel)imsg.Channel; @@ -286,6 +268,29 @@ namespace NadekoBot.Modules.Administration if (!conf.SendChannelByeMessage) await channel.SendMessageAsync("Enable bye messsages by typing `.bye`").ConfigureAwait(false); } + + [LocalizedCommand, LocalizedDescription, LocalizedSummary] + [RequireContext(ContextType.Guild)] + [RequirePermission(GuildPermission.ManageGuild)] + public async Task ByeDel(IMessage imsg) + { + var channel = (ITextChannel)imsg.Channel; + + GuildConfig conf; + using (var uow = DbHandler.UnitOfWork()) + { + conf = uow.GuildConfigs.For(channel.Guild.Id); + conf.AutoDeleteByeMessages = !conf.AutoDeleteByeMessages; + uow.GuildConfigs.Update(conf); + await uow.CompleteAsync(); + } + + if (conf.AutoDeleteByeMessages) + await channel.SendMessageAsync("`Automatic deletion of bye messages has been enabled.`").ConfigureAwait(false); + else + await channel.SendMessageAsync("`Automatic deletion of bye messages has been disabled.`").ConfigureAwait(false); + } + } } } \ No newline at end of file diff --git a/src/NadekoBot/Resources/CommandStrings.Designer.cs b/src/NadekoBot/Resources/CommandStrings.Designer.cs index d678b140..3ed74b6a 100644 --- a/src/NadekoBot/Resources/CommandStrings.Designer.cs +++ b/src/NadekoBot/Resources/CommandStrings.Designer.cs @@ -842,6 +842,33 @@ namespace NadekoBot.Resources { } } + /// + /// Looks up a localized string similar to Toggles automatic deletion of bye messages. **Needs Manage Server Permissions.**. + /// + public static string byedel_desc { + get { + return ResourceManager.GetString("byedel_desc", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to `.byedel`. + /// + public static string byedel_summary { + get { + return ResourceManager.GetString("byedel_summary", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to byedel. + /// + public static string byedel_text { + get { + return ResourceManager.GetString("byedel_text", resourceCulture); + } + } + /// /// Looks up a localized string similar to Sets a new leave announcement message. Type %user% if you want to mention the new member. Using it with no message will show the current bye message. **Needs Manage Server Permissions.**. /// @@ -869,33 +896,6 @@ namespace NadekoBot.Resources { } } - /// - /// Looks up a localized string similar to Toggles whether the good bye messages will be sent in a PM or in the text channel. **Needs Manage Server Permissions.**. - /// - public static string byepm_desc { - get { - return ResourceManager.GetString("byepm_desc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to `.byepm`. - /// - public static string byepm_summary { - get { - return ResourceManager.GetString("byepm_summary", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to byepm. - /// - public static string byepm_text { - get { - return ResourceManager.GetString("byepm_text", resourceCulture); - } - } - /// /// Looks up a localized string similar to Shows all available operations in .calc command. /// @@ -2705,33 +2705,6 @@ namespace NadekoBot.Resources { } } - /// - /// Looks up a localized string similar to Toggles automatic deletion of greet and bye messages. **Needs Manage Server Permissions.**. - /// - public static string grdel_desc { - get { - return ResourceManager.GetString("grdel_desc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to `.grdel`. - /// - public static string grdel_summary { - get { - return ResourceManager.GetString("grdel_summary", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to grdel. - /// - public static string grdel_text { - get { - return ResourceManager.GetString("grdel_text", resourceCulture); - } - } - /// /// Looks up a localized string similar to Toggles anouncements on the current channel when someone joins the server. **Needs Manage Server Permissions.**. /// @@ -2760,7 +2733,88 @@ namespace NadekoBot.Resources { } /// - /// Looks up a localized string similar to Sets a new join announcement message. Type %user% if you want to mention the new member. Using it with no message will show the current greet message. **Needs Manage Server Permissions.**. + /// Looks up a localized string similar to Toggles automatic deletion of greet messages. **Needs Manage Server Permissions.**. + /// + public static string greetdel_desc { + get { + return ResourceManager.GetString("greetdel_desc", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to `.greetdel`. + /// + public static string greetdel_summary { + get { + return ResourceManager.GetString("greetdel_summary", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to greetdel. + /// + public static string greetdel_text { + get { + return ResourceManager.GetString("greetdel_text", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Toggles whether the greet messages will be sent in a DM (This is separate from greet - you can have both, any or neither enabled). **Needs Manage Server Permissions.**. + /// + public static string greetdm_desc { + get { + return ResourceManager.GetString("greetdm_desc", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to `.greetdm`. + /// + public static string greetdm_summary { + get { + return ResourceManager.GetString("greetdm_summary", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to greetdm. + /// + public static string greetdm_text { + get { + return ResourceManager.GetString("greetdm_text", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Sets a new join announcement message which will be sent to the user who joined. Type %user% if you want to mention the new member. Using it with no message will show the current DM greet message. **Needs Manage Server Permissions.**. + /// + public static string greetdmmsg_desc { + get { + return ResourceManager.GetString("greetdmmsg_desc", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to `.greetdmmsg Welcome to the server, %user%`.. + /// + public static string greetdmmsg_summary { + get { + return ResourceManager.GetString("greetdmmsg_summary", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to greetdmmsg. + /// + public static string greetdmmsg_text { + get { + return ResourceManager.GetString("greetdmmsg_text", resourceCulture); + } + } + + /// + /// Looks up a localized string similar to Sets a new join announcement message which will be shown in the server's channel. Type %user% if you want to mention the new member. Using it with no message will show the current greet message. **Needs Manage Server Permissions.**. /// public static string greetmsg_desc { get { @@ -2786,33 +2840,6 @@ namespace NadekoBot.Resources { } } - /// - /// Looks up a localized string similar to Toggles whether the greet messages will be sent in a PM or in the text channel. **Needs Manage Server Permissions.**. - /// - public static string greetpm_desc { - get { - return ResourceManager.GetString("greetpm_desc", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to `.greetpm`. - /// - public static string greetpm_summary { - get { - return ResourceManager.GetString("greetpm_summary", resourceCulture); - } - } - - /// - /// Looks up a localized string similar to greetpm. - /// - public static string greetpm_text { - get { - return ResourceManager.GetString("greetpm_text", resourceCulture); - } - } - /// /// Looks up a localized string similar to Sends a readme and a guide links to the channel.. /// diff --git a/src/NadekoBot/Resources/CommandStrings.resx b/src/NadekoBot/Resources/CommandStrings.resx index 3d90ae9c..38be8b2c 100644 --- a/src/NadekoBot/Resources/CommandStrings.resx +++ b/src/NadekoBot/Resources/CommandStrings.resx @@ -162,14 +162,14 @@ `-commands` or `.commands` - - grdel + + greetdel - - Toggles automatic deletion of greet and bye messages. **Needs Manage Server Permissions.** + + Toggles automatic deletion of greet messages. **Needs Manage Server Permissions.** - - `.grdel` + + `.greetdel` greet @@ -184,7 +184,7 @@ greetmsg - Sets a new join announcement message. Type %user% if you want to mention the new member. Using it with no message will show the current greet message. **Needs Manage Server Permissions.** + Sets a new join announcement message which will be shown in the server's channel. Type %user% if you want to mention the new member. Using it with no message will show the current greet message. **Needs Manage Server Permissions.** `.greetmsg Welcome, %user%.` @@ -207,23 +207,23 @@ `.byemsg %user% has left.` - - byepm + + byedel - - Toggles whether the good bye messages will be sent in a PM or in the text channel. **Needs Manage Server Permissions.** + + Toggles automatic deletion of bye messages. **Needs Manage Server Permissions.** - - `.byepm` + + `.byedel` - - greetpm + + greetdm - - Toggles whether the greet messages will be sent in a PM or in the text channel. **Needs Manage Server Permissions.** + + Toggles whether the greet messages will be sent in a DM (This is separate from greet - you can have both, any or neither enabled). **Needs Manage Server Permissions.** - - `.greetpm` + + `.greetdm` spmom @@ -2628,4 +2628,13 @@ delallq + + greetdmmsg + + + `.greetdmmsg Welcome to the server, %user%`. + + + Sets a new join announcement message which will be sent to the user who joined. Type %user% if you want to mention the new member. Using it with no message will show the current DM greet message. **Needs Manage Server Permissions.** + \ No newline at end of file