Skip to content

Commit 231f53c

Browse files
committed
πŸ’„ Add an interaction route example to command generator stubs
1 parent 91ea28a commit 231f53c

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

β€Žsrc/Console/Commands/stubs/command.stub

+12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace {{ namespace }};
44

5+
use Discord\Parts\Interactions\Interaction;
56
use Laracord\Commands\Command;
67

78
class {{ class }} extends Command
@@ -47,6 +48,17 @@ class {{ class }} extends Command
4748
->message()
4849
->title('{{ class }}')
4950
->content('Hello world!')
51+
->button('πŸ‘‹', route: 'wave')
5052
->send($message);
5153
}
54+
55+
/**
56+
* The command interaction routes.
57+
*/
58+
public function interactions(): array
59+
{
60+
return [
61+
'wave' => fn (Interaction $interaction) => $this->message('πŸ‘‹')->reply($interaction),
62+
];
63+
}
5264
}

β€Žsrc/Console/Commands/stubs/slash-command.stub

+12
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace {{ namespace }};
44

5+
use Discord\Parts\Interactions\Interaction;
56
use Laracord\Commands\SlashCommand;
67

78
class {{ class }} extends SlashCommand
@@ -61,7 +62,18 @@ class {{ class }} extends SlashCommand
6162
->message()
6263
->title('{{ class }}')
6364
->content('Hello world!')
65+
->button('πŸ‘‹', route: 'wave')
6466
->build()
6567
);
6668
}
69+
70+
/**
71+
* The command interaction routes.
72+
*/
73+
public function interactions(): array
74+
{
75+
return [
76+
'wave' => fn (Interaction $interaction) => $this->message('πŸ‘‹')->reply($interaction),
77+
];
78+
}
6779
}

0 commit comments

Comments
Β (0)