Skip to content

Commit ebf5882

Browse files
authored
πŸ§‘β€πŸ’» Add id to the Message button() method (#59)
2 parents af0e802 + 655f62b commit ebf5882

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

β€Žconfig/app.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
|
2727
*/
2828

29-
'locale' => 'en',
29+
'locale' => env('APP_LOCALE', 'en'),
3030

3131
/*
3232
|--------------------------------------------------------------------------
@@ -39,7 +39,7 @@
3939
|
4040
*/
4141

42-
'fallback_locale' => 'en',
42+
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),
4343

4444
/*
4545
|--------------------------------------------------------------------------

β€Žsrc/Discord/Message.php

+5-1
Original file line numberDiff line numberDiff line change
@@ -626,7 +626,7 @@ public function components(array $components): self
626626
/**
627627
* Add a URL button to the message.
628628
*/
629-
public function button(string $label, mixed $value, mixed $emoji = null, ?string $style = null, bool $disabled = false, array $options = []): self
629+
public function button(string $label, mixed $value, mixed $emoji = null, ?string $style = null, bool $disabled = false, ?string $id = null, array $options = []): self
630630
{
631631
$style = match ($style) {
632632
'link' => Button::STYLE_LINK,
@@ -644,6 +644,10 @@ public function button(string $label, mixed $value, mixed $emoji = null, ?string
644644
->setEmoji($emoji)
645645
->setDisabled($disabled);
646646

647+
if ($id) {
648+
$button = $button->setCustomId($id);
649+
}
650+
647651
if ($options) {
648652
foreach ($options as $key => $option) {
649653
$key = Str::of($key)->camel()->ucfirst()->start('set')->toString();

0 commit comments

Comments
Β (0)