telegram-bot-sdk
telegram-bot-sdk copied to clipboard
Emit a new UpdateEvent
UpdateEvent
event back-ported from SDK v4.
Differences with SDKv4 events:
- event from SDKv4 has
public Bot $bot
, in current PR it'spublic Api $telegram;
. Reason -- there is noBot
class in SDK v3. - in this PR this event extends
\League\Event\AbstractEvent
(because we useleague/event
events system here), in SDK v4 it doesn't extend any classes. - this PR has better test than in SDK v4 :)
Challenges
SDK v3 has a weird feature, I don't know a reason why we have it. This is $shouldEmitEvent
parameter:
// in Update.php trait
public function getWebhookUpdate($shouldEmitEvent = true, ...
I decided to not touch it, always emit a new event and keep emitting the old one UpdateWasReceived
depends on $shouldEmitEvent argument's value. Reason - it provides more consistency with SDK v4.
Thank you 👍