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

onMessage blocking all other listeners #104

Closed
HeySreelal opened this issue Jun 14, 2023 · 2 comments
Closed

onMessage blocking all other listeners #104

HeySreelal opened this issue Jun 14, 2023 · 2 comments

Comments

@HeySreelal
Copy link
Owner

Somehow when onMessage is attached all other listeners are ignored and only onMessage handler is being executed.

@HeySreelal
Copy link
Owner Author

This one is weird.

Televerse now depends on HandlerScope to add listeners to the events. This is to simplify the resource usage and to achieve #84. As this issue was raised , I tested the flow for the following snippet:

bot.command(...);
bot.command(..);
bot.onMessage(...);

And interestingly found that even though all listeners are added to the handler scopes list using List.add somehow the listeners are added to the first position.

Hence, onMessage listener is always called when an update is occurred, ignoring all other handlers.

@HeySreelal
Copy link
Owner Author

Using List.reversed seems to solve this issue simply. But, I need to keep an eye on this.

HeySreelal added a commit that referenced this issue Jun 15, 2023
`onMessage` fix.
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

1 participant