I’ve trawled the forums, the Discord and what feels like the whole of Google trying to find an answer to this conundrum and I’m stumped. I’m aware there are similar issues in the forum but they are either not solving the issue or seemingly outdated. I’ll try to summarise the problem briefly.
-
I’m working on a “Twitch-Plays” social deduction game in Unity. I’ve previously made Twitch-Interactive games in Unity without a problem. The difference here is that certain players will need “secret” information (i.e. information hidden from other players) so I’m having to implement a system whereby the bot can whisper to certain individuals, giving them information that is hidden from other players. The maximum number of whispers per game will be 9 (and a game can last anything from 15 to 30 minutes).
-
I was originally generating an oauth token from twitchapps/tmi, but I had it pointed out to me that that doesn’t support whispering other users. I found an alternative website (https://twitchtokengenerator.com) which looks like it does. However, it’s having difficulties.
-
I have two Twitch accounts; the first is my real account which I use to stream the games and chat with people. The second is a “bot” account, which is used to receive whispers and type public information into the chat. This is also the account I would like to be able to whisper.
-
I’ve tried two different strategies to make whispers work:
- Creating an oauth token for my actual account (royal_flush).
- Creating an oauth token for my “bot” account (persephones_twitch_bot)
-
In the former, whispers work “sometimes”. It’s a bit inconsistent and I’m getting a variety of reactions in the console, ranging from not delivering whispers to myself (“unable to whisper to yourself”), nothing at all appearing in the console (and no whisper being delivered) and occasionally, whispers being delivered successfully. It’s slightly academic since I don’t want this account to be the account that is whispered to; the idea is that the “host player” should also be able to partake in the game. With this system, that’s impossible.
-
In the latter, whispers are returned with a console message saying “your settings don’t allow for this whisper to be delivered”. This despite the fact I flagged the “whisper:edit” box as yes on the oauth generator.
-
I feel all the pieces are sort of there but something is amiss. Why would my actual account allow whispers but not the bot account? My only theory is that something is amiss in my connection method (shown below).
-
I have tried to have the bot account verified as a “known-bot”, but the application was rejected. Moreover, I don’t feel that for at most 9 whispers per half hour every once in a while when I stream is really sufficient grounds for becoming a “known-bot”. This is a really frustrating issue and if anybody can help out at all, I’d be really grateful. Happy to do a screenshare/voice chat showing my code if anybody is willing. Many thanks.
private void Connect()
{
twitchClient = new TcpClient(“irc.chat.twitch.tv”, 6667);
reader = new StreamReader(twitchClient.GetStream());
writer = new StreamWriter(twitchClient.GetStream());writer.WriteLine("PASS " + persAccessToken); writer.WriteLine("NICK " + username); writer.WriteLine("USER " + username + " 8 * :" + username); writer.WriteLine("JOIN #" + channelName); writer.WriteLine("CAP REQ :twitch.tv/commands"); writer.WriteLine(":persephones_twitch_bot!persephones_twitch_bot@persephones_twitch_bot.tmi.twitch.tv PRIVMSG #royal_flush :/w royal_flush Online. Let's Play."); writer.Flush(); }