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

[Question] Event list ? #137

Closed
KaKi87 opened this issue Apr 26, 2023 · 5 comments
Closed

[Question] Event list ? #137

KaKi87 opened this issue Apr 26, 2023 · 5 comments

Comments

@KaKi87
Copy link

KaKi87 commented Apr 26, 2023

Hello,

The README mentions two events, update and error :

tdl/README.md

Lines 162 to 175 in 1e1401e

#### `client.on(event: string, callback: Function) => Client`
Attach an event listener to receive updates.
```javascript
function onUpdate (update) {
console.log('New update:', update)
}
client.on('update', onUpdate)
client.on('error', console.error)
```
Ideally, you should always have a listener on `client.on('error')`.
There is no default listener, all errors will be ignored otherwise.

Would it be possible to write an exhaustive list ?

Thanks

@Bannerets
Copy link
Owner

Bannerets commented May 28, 2024

Since tdl v8.0.0, all events except update, error, close are removed, and close is documented.

(edit: reworded)

@KaKi87
Copy link
Author

KaKi87 commented May 28, 2024

Then now to listen to messages ?

And how are errors now handled ?

Thanks

@Bannerets
Copy link
Owner

I meant "other [than update or error]", sorry, so update, error, and close are now left. (The other ones were too advanced / deprecated.)

@KaKi87
Copy link
Author

KaKi87 commented May 28, 2024

Okay, but then how to receive messages ?

Thanks

@Bannerets
Copy link
Owner

Using the update handler (and filtering for updateNewMessage) or the recently added client.iterUpdates.

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

No branches or pull requests

2 participants