tmijs / tmi.js

💬 Javascript library for the Twitch Messaging Interface. (Twitch.tv)
https://tmijs.com
MIT License
1.55k stars 214 forks source link

client.whisper #221

Closed Utto closed 5 years ago

Utto commented 7 years ago

Hello there, looks like there is still wrong with client.whisper.

I am trying to /w to user:

client.whisper(userstate.username, "test").then(function(data) {
  console.log('data', data);
}).catch(function(err) {
  console.log('something went wrong', err);
});

I am getting back data in console, no any errors, also

info: [#jtv] Executing command: /w 'here is the correct username' test

but nothing happens.

I tried to update to 1.2.0 version but got the same result, correct data,

info: [#tmijs] Executing command: /w 'here is the correct username' test

and still nothing.

Interesting thing is when the user how is supposed to get message is broadcaster of the channel he is able to receive the whisper, but nobody else is not.

Operating system: Windows 10 Node version: 6.10.2 npm version: 4.4.4 Tmi.js version I've used: 1.1.2, 1.2.0.

Looking forward for your answer.

roberthartung commented 7 years ago

Just discovered the same. PRIVMSG #tmijs :/w name test is send over the WebSocket, but nothing happens afterwards!

It should use the IM api: https://im.twitch.tv/v1/messages?on_site= with POST:


{
  "body" : "test",
  "from_id" : 0000000,
  "nonce" : "Rqdj7nJSVnNjvL0JFlHFxK1UZEiR1b",
  "on_site" : "",
  "to_id" : 0000000
}```

where nonce seems to be a random 30 character long string (a-zA-Z0-9).
AlcaDesign commented 7 years ago

I'm not sure what the actual problem is. Everything seems to be working correctly.

Manual through wscat image

tmi.js image

The result image

If someone could be more specific as to what isn't happening, we might be able to find the issue.

roberthartung commented 7 years ago

The user being whispered to in my case is a DeepBot. It is whitelisted and is usually able to receive whispers. I was now able to get some more information from the users using my Extension, that is based on TMI.

While both the messages !bet 49999 2 and !bet 51010 2 are sent, !bet 50000 2 is not. I am still not sure why this happens. I will have to debug this on my own and provide you with further information. Maybe Twitch is filtering out the messages because it contains a 50000? I am not sure! I will let you know ...

roberthartung commented 7 years ago

Ok I can confirm this now. I can send messages like test but NOT !bet 50000 2.

[09:11] info: [#tmijs] Executing command: /w nookys_cookiemonster !bet 12345 2
[09:11] info: [#tmijs] Executing command: /w nookys_cookiemonster !bet 50 1
[09:11] info: [#tmijs] Executing command: /w nookys_cookiemonster !bet 500 1
[09:12] info: [#tmijs] Executing command: /w nookys_cookiemonster !bet 5000 1
[09:12] info: [#tmijs] Executing command: /w nookys_cookiemonster !bet 50000 1

All messages except the last one are sent and I can see them in the chat window: image

However, I can send !bet 500000 1, but not 50000, which means Twitch somehow prevents the word 50000 from being send?

Schmoopiie commented 7 years ago

Just tested and it's working fine on my end

dancrodev commented 7 years ago

I have a similar problem, not sure if it's because of the new version of the Twitch API, if I follow my bot it can send me PMs, but if I'm not following it, I can't send event driven PMs.

Any thoughts? Maybe I'm missing something.

Utto commented 7 years ago

Yeah, can confirm it, got the same thing. I can see PMs from my bot only if I am following it. Unfortunately no ideas atm how to avoid it.

metal-messiah commented 7 years ago

any solution to this yet? I can also only receive whispers from the bot if I am following it.

AlcaDesign commented 7 years ago

@metal-messiah You need to submit your bot account here: https://discuss.dev.twitch.tv/t/have-a-chat-whisper-bot-let-us-know/10651

roberthartung commented 7 years ago

@AlcaDesign No. This has nothing to do with submitting the bot to the whitelist. Even after it was whitelisted, problems occured. The simple solution would be to use the actual whisper service, instead of PRIVMSG to a user.