app/Console/Commands/RegisterApplicationCommands.php
/**
     * Execute the console command.
     *
     * @return int
     */
Execute the console command.
@return int
Execute the console command . @return int
public function handle()
    {
        $commandControllers = config('discord.application_commands', []);
        $commands = [];
        try {
            foreach ($commandControllers as $commandController) {
                $data = $this->getCommandDataFromController($commandController);
                $commands[] = $data;
                $this->info("Discovered {$data['name']}");
            }
        } catch (\Exception $exception) {
            return 1;
        }
        $resp = $this->registerCommands($commands);
        if ($resp->ok()) {
            $guildId = $this->argument('guild');
            $this->info($guildId ? "Commands updated for $guildId." : 'Global commands updated.');
            return 0;
        }
        $this->error("Failed to update commands: " . $resp->body());
        return 1;
    }
public function handle ( ) { $ commandControllers = config ( 'discord.application_commands' , [ ] ) ; $ commands = [ ] ; try { foreach ( $ commandControllers as $ commandController ) { $ data = $ this -> getCommandDataFromController ( $ commandController ) ; $ commands [ ] = $ data ; $ this -> info ( " Discovered  { $ data [ 'name' ] } " ) ; } } catch ( \ Exception $ exception ) { return 1 ; } $ resp = $ this -> registerCommands ( $ commands ) ; if ( $ resp -> ok ( ) ) { $ guildId = $ this -> argument ( 'guild' ) ; $ this -> info ( $ guildId ? " Commands updated for  $ guildId . " : 'Global commands updated.' ) ; return 0 ; } $ this -> error ( " Failed to update commands:  " . $ resp -> body ( ) ) ; return 1 ; }
Execute the console command.
Execute the console command .