]> git.localhorst.tv Git - alttp.git/blobdiff - app/DiscordBotCommands/BaseCommand.php
tech relations
[alttp.git] / app / DiscordBotCommands / BaseCommand.php
index eb3a012561c9bdc8f6e6faae8145797fff51e3be..b043af2ecd7f06da98e242381ebf3ceda3f7361f 100644 (file)
@@ -30,6 +30,9 @@ abstract class BaseCommand {
        protected function __construct(Discord $discord, DiscordBotCommand $cmd) {
                $this->discord = $discord;
                $this->command = $cmd;
+               if ($cmd->tournament && $cmd->tournament->locale) {
+                       App::setLocale($cmd->tournament->locale);
+               }
        }
 
        protected function fetchGuild() {
@@ -40,7 +43,7 @@ abstract class BaseCommand {
                        ->fetch($this->command->tournament->discord)
                        ->then(function (Guild $guild) {
                                $this->guild = $guild;
-                               if ($guild->preferred_locale) {
+                               if ($guild->preferred_locale && !($this->command->tournament && $this->command->tournament->locale)) {
                                        App::setLocale($guild->preferred_locale);
                                }
                                return $guild;