]> git.localhorst.tv Git - alttp.git/commitdiff
remove aosr command
authorDaniel Karbach <daniel.karbach@localhorst.tv>
Tue, 1 Aug 2023 15:24:49 +0000 (17:24 +0200)
committerDaniel Karbach <daniel.karbach@localhorst.tv>
Tue, 1 Aug 2023 15:24:49 +0000 (17:24 +0200)
app/Console/Commands/DiscordBotCommand.php
app/DiscordAppCommands/AosrPresetCommand.php

index 9493ba32d3cff115c7ad9ef4cbab067206ab8ef5..6c9dba91db8e09952168f97a2a7f54f5f81ff855 100644 (file)
@@ -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) {
index 7a8907a419c87b3258ded2761bed28144de30380..e4d0fbb529ddf08c0eab8756f2fef82fa0d791f2 100644 (file)
@@ -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];