Skip to content

Commit

Permalink
Merge pull request #266 from defstudio/dice-method-missing-in-chat
Browse files Browse the repository at this point in the history
[fix] add missing dice method in TelegraphChat
  • Loading branch information
fabio-ivona authored Nov 20, 2022
2 parents 40d5679 + 180e9a3 commit c82f849
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
13 changes: 10 additions & 3 deletions docs/content/en/models/telegraph-chat.md
Original file line number Diff line number Diff line change
Expand Up @@ -479,9 +479,7 @@ $telegraphChat->poll("What's your favourite programming language?")
creates a quiz. For more info, see telegram [bot documentation](https://core.telegram.org/bots/api#sendpoll)

```php
use DefStudio\Telegraph\Models\TelegraphChat;

/** @var TelegraphChat $telegraphChat */
/** @var DefStudio\Telegraph\Models\TelegraphChat $telegraphChat */
$telegraphChat->quiz("What's your favourite programming language?")
->option('php', correct: true)
->option('typescript')
Expand All @@ -490,3 +488,12 @@ $telegraphChat->quiz("What's your favourite programming language?")
->validUntil(now()->addMinutes(5))
->send();
```

### `dice`

An animated emoji attachment that will display a random value can be sent through Telegraph `->dice()` method:

```php
/** @var DefStudio\Telegraph\Models\TelegraphChat $telegraphChat */
$telegraphChat->dice()->send();
```
5 changes: 5 additions & 0 deletions src/Models/TelegraphChat.php
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,11 @@ public function quiz(string $question): TelegraphQuizPayload
return TelegraphFacade::chat($this)->quiz($question);
}

public function dice(string $emoji = null): Telegraph
{
return TelegraphFacade::chat($this)->dice($emoji);
}

public function forwardMessage(TelegraphChat|int $fromChat, int $messageId): Telegraph
{
return TelegraphFacade::chat($this)->forwardMessage($fromChat, $messageId);
Expand Down

0 comments on commit c82f849

Please sign in to comment.