From a12702fb68522513a0e6e6dffe67891c7e9b21e9 Mon Sep 17 00:00:00 2001 From: Master Kwoth Date: Mon, 9 Oct 2017 02:57:03 +0200 Subject: [PATCH] you can no longer use .die as a startup command... --- NadekoBot.Core/Modules/Administration/SelfCommands.cs | 4 +++- NadekoBot.Core/Modules/Administration/Services/SelfService.cs | 4 ++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/NadekoBot.Core/Modules/Administration/SelfCommands.cs b/NadekoBot.Core/Modules/Administration/SelfCommands.cs index 0250ede9..ca526f48 100644 --- a/NadekoBot.Core/Modules/Administration/SelfCommands.cs +++ b/NadekoBot.Core/Modules/Administration/SelfCommands.cs @@ -48,7 +48,9 @@ namespace NadekoBot.Modules.Administration [OwnerOnly] public async Task StartupCommandAdd([Remainder] string cmdText) { - //todo don't let .die be a startup command + if (cmdText.StartsWith(Prefix + "die")) + return; + var guser = ((IGuildUser)Context.User); var cmd = new StartupCommand() { diff --git a/NadekoBot.Core/Modules/Administration/Services/SelfService.cs b/NadekoBot.Core/Modules/Administration/Services/SelfService.cs index 93699858..c0a811fa 100644 --- a/NadekoBot.Core/Modules/Administration/Services/SelfService.cs +++ b/NadekoBot.Core/Modules/Administration/Services/SelfService.cs @@ -48,6 +48,10 @@ namespace NadekoBot.Modules.Administration.Services foreach (var cmd in bc.BotConfig.StartupCommands) { + var prefix = _cmdHandler.GetPrefix(cmd.GuildId); + //if someone already has .die as their startup command, ignore it + if (cmd.CommandText.StartsWith(prefix + "die")) + continue; await cmdHandler.ExecuteExternal(cmd.GuildId, cmd.ChannelId, cmd.CommandText); await Task.Delay(400).ConfigureAwait(false); }