If .greetmsg or .byemsg are ran without arguments, print the current greet/bye message
This commit is contained in:
parent
beafacf469
commit
872b7bc1df
@ -245,13 +245,18 @@ namespace NadekoBot.Modules.Administration.Commands
|
|||||||
});
|
});
|
||||||
|
|
||||||
cgb.CreateCommand(Module.Prefix + "greetmsg")
|
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)
|
.Parameter("msg", ParameterType.Unparsed)
|
||||||
.Do(async e =>
|
.Do(async e =>
|
||||||
{
|
{
|
||||||
if (!e.User.ServerPermissions.ManageServer) return;
|
if (!e.User.ServerPermissions.ManageServer) return;
|
||||||
if (e.GetArg("msg") == null) return;
|
|
||||||
var ann = AnnouncementsDictionary.GetOrAdd(e.Server.Id, new AnnounceControls(e.Server.Id));
|
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");
|
ann.GreetText = e.GetArg("msg");
|
||||||
await e.Channel.SendMessage("New greet message set.").ConfigureAwait(false);
|
await e.Channel.SendMessage("New greet message set.").ConfigureAwait(false);
|
||||||
@ -273,13 +278,17 @@ namespace NadekoBot.Modules.Administration.Commands
|
|||||||
});
|
});
|
||||||
|
|
||||||
cgb.CreateCommand(Module.Prefix + "byemsg")
|
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)
|
.Parameter("msg", ParameterType.Unparsed)
|
||||||
.Do(async e =>
|
.Do(async e =>
|
||||||
{
|
{
|
||||||
if (!e.User.ServerPermissions.ManageServer) return;
|
if (!e.User.ServerPermissions.ManageServer) return;
|
||||||
if (e.GetArg("msg") == null) return;
|
|
||||||
var ann = AnnouncementsDictionary.GetOrAdd(e.Server.Id, new AnnounceControls(e.Server.Id));
|
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");
|
ann.ByeText = e.GetArg("msg");
|
||||||
await e.Channel.SendMessage("New bye message set.").ConfigureAwait(false);
|
await e.Channel.SendMessage("New bye message set.").ConfigureAwait(false);
|
||||||
|
Loading…
Reference in New Issue
Block a user