Skip to content

Commit

Permalink
πŸ§‘β€πŸ’» Add id to the Message button() method (#59)
Browse files Browse the repository at this point in the history
  • Loading branch information
Log1x authored May 16, 2024
2 parents af0e802 + 655f62b commit ebf5882
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 2 additions & 2 deletions config/app.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
|
*/

'locale' => 'en',
'locale' => env('APP_LOCALE', 'en'),

/*
|--------------------------------------------------------------------------
Expand All @@ -39,7 +39,7 @@
|
*/

'fallback_locale' => 'en',
'fallback_locale' => env('APP_FALLBACK_LOCALE', 'en'),

/*
|--------------------------------------------------------------------------
Expand Down
6 changes: 5 additions & 1 deletion src/Discord/Message.php
Original file line number Diff line number Diff line change
Expand Up @@ -626,7 +626,7 @@ public function components(array $components): self
/**
* Add a URL button to the message.
*/
public function button(string $label, mixed $value, mixed $emoji = null, ?string $style = null, bool $disabled = false, array $options = []): self
public function button(string $label, mixed $value, mixed $emoji = null, ?string $style = null, bool $disabled = false, ?string $id = null, array $options = []): self
{
$style = match ($style) {
'link' => Button::STYLE_LINK,
Expand All @@ -644,6 +644,10 @@ public function button(string $label, mixed $value, mixed $emoji = null, ?string
->setEmoji($emoji)
->setDisabled($disabled);

if ($id) {
$button = $button->setCustomId($id);
}

if ($options) {
foreach ($options as $key => $option) {
$key = Str::of($key)->camel()->ucfirst()->start('set')->toString();
Expand Down

0 comments on commit ebf5882

Please sign in to comment.