From: Daniel Karbach Date: Tue, 1 Aug 2023 15:24:49 +0000 (+0200) Subject: remove aosr command X-Git-Url: https://git.localhorst.tv/?a=commitdiff_plain;h=9e08a6086d2c982ec9a2b9b79e3441ac8347f695;p=alttp.git remove aosr command --- diff --git a/app/Console/Commands/DiscordBotCommand.php b/app/Console/Commands/DiscordBotCommand.php index 9493ba3..6c9dba9 100644 --- a/app/Console/Commands/DiscordBotCommand.php +++ b/app/Console/Commands/DiscordBotCommand.php @@ -68,10 +68,10 @@ class DiscordBotCommand extends Command }); if (config('discord.enable_commands')) { - AosrPresetCommand::listen($discord); + //AosrPresetCommand::listen($discord); } if (config('discord.create_commands')) { - AosrPresetCommand::create($discord); + AosrPresetCommand::delete($discord); } }); $discord->on(Event::GUILD_CREATE, function (Guild $guild, Discord $discord) { diff --git a/app/DiscordAppCommands/AosrPresetCommand.php b/app/DiscordAppCommands/AosrPresetCommand.php index 7a8907a..e4d0fbb 100644 --- a/app/DiscordAppCommands/AosrPresetCommand.php +++ b/app/DiscordAppCommands/AosrPresetCommand.php @@ -54,6 +54,17 @@ class AosrPresetCommand { $discord->application->commands->save($cmd); } + public static function delete(Discord $discord) { + $discord->application->commands->freshen()->then(function () use ($discord) { + $cmd = $discord->application->commands->find(function ($cmd) { + return $cmd->name == 'aosr'; + }); + if ($cmd) { + $discord->application->commands->delete($cmd); + } + }); + } + public static function presetByName($name) { if (isset(static::$presets[$name])) { return static::$presets[$name];