If .greetmsg or .byemsg are ran without arguments, print the current greet/bye message

This commit is contained in:
Master Kwoth 2016-05-02 21:33:01 +02:00
parent beafacf469
commit 872b7bc1df

View File

@ -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);