Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Emit UpdateEvent event similar to SDK v4 #998

Merged
merged 8 commits into from
Aug 20, 2022

Conversation

alies-dev
Copy link
Contributor

@alies-dev alies-dev commented Aug 9, 2022

UpdateEvent event back-ported from SDK v4.

Differences with SDKv4 events:

  • event from SDKv4 has public Bot $bot, in current PR it's public Api $telegram;. Reason -- there is no Bot class in SDK v3.
  • in this PR this event extends \League\Event\AbstractEvent (because we use league/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.

src/Methods/Update.php Outdated Show resolved Hide resolved
@alies-dev alies-dev changed the title Emit a new UpdateEvent Emit similar events as in SDK v4 Aug 20, 2022
@alies-dev alies-dev changed the title Emit similar events as in SDK v4 Emit UpdateEvent event similar to SDK v4 Aug 20, 2022
@irazasyed irazasyed merged commit ceee333 into irazasyed:develop Aug 20, 2022
@irazasyed
Copy link
Owner

Thank you 👍

@alies-dev alies-dev deleted the emit-new-update-event branch August 20, 2022 19:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants