From 872b7bc1df33ca96549f7368971432a20bce2842 Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Mon, 2 May 2016 21:33:01 +0200 Subject: [PATCH] If .greetmsg or .byemsg are ran without arguments, print the current greet/bye message --- .../Commands/ServerGreetCommand.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/NadekoBot/Modules/Administration/Commands/ServerGreetCommand.cs b/NadekoBot/Modules/Administration/Commands/ServerGreetCommand.cs index 398ce975..f5c3af29 100644 --- a/NadekoBot/Modules/Administration/Commands/ServerGreetCommand.cs +++ b/NadekoBot/Modules/Administration/Commands/ServerGreetCommand.cs @@ -245,13 +245,18 @@ namespace NadekoBot.Modules.Administration.Commands }); cgb.CreateCommand(Module.Prefix + "greetmsg") - .Description("Sets a new announce message. Type %user% if you want to mention the new member.\n**Usage**: .greetmsg Welcome to the server, %user%.") + .Description("Sets a new announce message. Type %user% if you want to mention the new member. Using it with no message will show the current greet message.\n**Usage**: .greetmsg Welcome to the server, %user%.") .Parameter("msg", ParameterType.Unparsed) .Do(async e => { if (!e.User.ServerPermissions.ManageServer) return; - if (e.GetArg("msg") == null) return; var ann = AnnouncementsDictionary.GetOrAdd(e.Server.Id, new AnnounceControls(e.Server.Id)); + if (string.IsNullOrWhiteSpace(e.GetArg("msg"))) + { + await e.Channel.SendMessage("`Current greet message:` " + ann.GreetText); + return; + } + ann.GreetText = e.GetArg("msg"); await e.Channel.SendMessage("New greet message set.").ConfigureAwait(false); @@ -273,13 +278,17 @@ namespace NadekoBot.Modules.Administration.Commands }); cgb.CreateCommand(Module.Prefix + "byemsg") - .Description("Sets a new announce leave message. Type %user% if you want to mention the new member.\n**Usage**: .byemsg %user% has left the server.") + .Description("Sets a new announce leave message. Type %user% if you want to mention the new member. Using it with no message will show the current bye message.\n**Usage**: .byemsg %user% has left the server.") .Parameter("msg", ParameterType.Unparsed) .Do(async e => { if (!e.User.ServerPermissions.ManageServer) return; - if (e.GetArg("msg") == null) return; var ann = AnnouncementsDictionary.GetOrAdd(e.Server.Id, new AnnounceControls(e.Server.Id)); + if (string.IsNullOrWhiteSpace(e.GetArg("msg"))) + { + await e.Channel.SendMessage("`Current bye message:` " + ann.ByeText); + return; + } ann.ByeText = e.GetArg("msg"); await e.Channel.SendMessage("New bye message set.").ConfigureAwait(false);