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

[BUG] can't subscribe to raid event #51

Closed
TiotBenjy opened this issue Jul 28, 2022 · 6 comments
Closed

[BUG] can't subscribe to raid event #51

TiotBenjy opened this issue Jul 28, 2022 · 6 comments
Labels
bug Something isn't working

Comments

@TiotBenjy
Copy link

Describe the bug
We can't subscribe to raid event

To Reproduce
Steps to reproduce the behavior:

  1. subscribe to raid event and then you have the following error :

TypeError: Cannot read properties of undefined (reading '0')
at EventManager.queueSubscription (/www/wwwroot/xxxxxxx/node_mjs/lib/events.js:49:42)
at /www/wwwroot/bot.jesuiskristoff.fr/xxxxxx/tesjs/lib/tes.js:180:38
at runMicrotasks ()
at processTicksAndRejections (node:internal/process/task_queues:96:5)

Expected behavior
If it is possible fix the issue

Environment:

  • OS: UBUNTU 20.04
  • Node Version [e.g. 15.3.0]: v16.15.1
  • TESjs Version [e.g. 0.1.0]: "tesjs": "^0.6.2",
@TiotBenjy TiotBenjy added the bug Something isn't working label Jul 28, 2022
@mitchwadair
Copy link
Owner

Hi! Could you please show how you are subscribing to the event?

@TiotBenjy
Copy link
Author

Yes sure ! There is the code :

tes.on('channel.raid', async (event) => {
       // my code when the event is triggered
});

// create a new subscription for the 'channel.raid' event for broadcaster
tes.subscribe('channel.raid', {
    broadcaster_user_id: 12345678
}).then(_ => {
    console.log("Subscribed to channel.raid event");
}).catch(err => {
    console.log("RAID SUBSCRIBE ERROR");
    console.log(err);
});

@mitchwadair
Copy link
Owner

mitchwadair commented Jul 29, 2022

Looks like your condition for the raid subscription is incorrect. You'll need either from_broadcaster_user_id or to_broadcaster_user_id (or maybe both) depending on what you are trying to accomplish with your event handler. Let me know if that fixes your problem!

As a side note, if that is the problem, I am intending to improve intellisense on conditions with #39. I should also probably try to improve the error handling/messaging here since it isn't immediately obvious what the source of the error is

@mitchwadair
Copy link
Owner

@TiotBenjy did this solve your problem? I'll be closing this if it did, or if I do not hear back soon 👍

@TiotBenjy
Copy link
Author

Hello,

Sorry I've forgotten to reply to your comment, yes it works ! Thanks for your help.

Have a great day.

@mitchwadair
Copy link
Owner

Great! Happy to help 🙂

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants