]> git.localhorst.tv Git - alttp.git/blobdiff - app/DiscordAppCommands/AosrPresetCommand.php
accept case insensitive presets over api
[alttp.git] / app / DiscordAppCommands / AosrPresetCommand.php
index 5ad05e00b0628c87145b467fa16a3c6a52d0e1ef..7a8907a419c87b3258ded2761bed28144de30380 100644 (file)
@@ -54,6 +54,18 @@ class AosrPresetCommand {
                $discord->application->commands->save($cmd);
        }
 
+       public static function presetByName($name) {
+               if (isset(static::$presets[$name])) {
+                       return static::$presets[$name];
+               }
+               foreach (static::$presets as $presetName => $preset) {
+                       if (strcasecmp($name, $presetName) === 0) {
+                               return $preset;
+                       }
+               }
+               return null;
+       }
+
        public static function listen(Discord $discord) {
                $discord->listenCommand(['aosr', 'preset'], function(Interaction $interaction) use ($discord) {
                        $interaction