Skip to content

Commit

Permalink
πŸ’„ Add an interaction route example to command generator stubs
Browse files Browse the repository at this point in the history
  • Loading branch information
Log1x committed Jun 5, 2024
1 parent 91ea28a commit 231f53c
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/Console/Commands/stubs/command.stub
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace {{ namespace }};

use Discord\Parts\Interactions\Interaction;
use Laracord\Commands\Command;

class {{ class }} extends Command
Expand Down Expand Up @@ -47,6 +48,17 @@ class {{ class }} extends Command
->message()
->title('{{ class }}')
->content('Hello world!')
->button('πŸ‘‹', route: 'wave')
->send($message);
}

/**
* The command interaction routes.
*/
public function interactions(): array
{
return [
'wave' => fn (Interaction $interaction) => $this->message('πŸ‘‹')->reply($interaction),
];
}
}
12 changes: 12 additions & 0 deletions src/Console/Commands/stubs/slash-command.stub
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace {{ namespace }};

use Discord\Parts\Interactions\Interaction;
use Laracord\Commands\SlashCommand;

class {{ class }} extends SlashCommand
Expand Down Expand Up @@ -61,7 +62,18 @@ class {{ class }} extends SlashCommand
->message()
->title('{{ class }}')
->content('Hello world!')
->button('πŸ‘‹', route: 'wave')
->build()
);
}

/**
* The command interaction routes.
*/
public function interactions(): array
{
return [
'wave' => fn (Interaction $interaction) => $this->message('πŸ‘‹')->reply($interaction),
];
}
}

0 comments on commit 231f53c

Please sign in to comment.