I currently have a bot that can write into the chat, send whispers, time people out, ban people, clear the chat and pretty much anything else I can think of.
/ban
/clear
/timeout
All work perfectly. However, I want it to also be able to trigger raids. Whenever I type in /raid or .raid nothing happens at all in the chat. If I go to the chat room and type this in myself, it works fine however.
Can anyone think of a reason why my bot is unable to do this?
I note that I am also unable to /host or /unhost.
My bot uses the same account as the channel, so it should have broadcaster access.
Does that suggest that there is a way to get it working? I mean if 2 different companies managed to do it, surely there’s a way to get it working.
I’m not sure how Twitch is detecting whether it’s a bot or not. As I said, it’s signed in as the channel, so I thought it would be seen as the broadcaster.
The only source I’ve been able to find about this is on this site here
Where it seems you state
I’ve not tested it, but logically since it’s a chat command, then calling .raid target over Chat. just like a .timeout or .me should work fine.
Theres no (un)official API end point that I know of for it either. Just chat.
Might I ask where you found out that it is not available?
Looking into it a little more, it seems likely that they are simply using an older version of the Twitch API. Looking at their code, I’m seeing references to Kraken pop up here and there, along with “passport.twitch.tv” instead of “id.twitch.tv”.
I can get Streamlabs Chatbot to trigger a raid by having it post "/raid " when I type in a command, such as "!raid ".
It’s a work around, requiring an external program, and while I’d prefer to do this without it, I think this is the best result I’m going to get.
You’re more than welcome to say it’s impossible
All I know for a fact is that I create a command in Streamlabs ChatBot that will have the chatbot say whatever I want when I say !bananas, for example.
When the program detects me saying something, it posts a custom message directly into the chat. Perhaps it’s this point that it’s doing something behind the scenes, such as your unsupported API end point.
When it sees "!Bananas ", it posts "/raid " or whatever else I ask it to post. This in turn successfully triggers the raid. Same works for /host and /unhost.
Twitch used to have the ability to trigger raids and follow people using bots, but they removed that feature for new applications, leaving it in place for those that were created before its removal. New applications do not have access to it (found it on the Twitch API documentation).
My theory was that these older programs, that I’ve seen are still using code from 2 years ago, are still able to do it.
In any case, I’ve found a way around it, and it turns out bots indeed can start a raid through a little effort
/timeout only requires channel moderator permissions, where as /raid, /host and /unhost all require channel editor permissions (through the channel_editor scope, or the user attempting to run those commands being set as an editor by the broadcaster through their dashboard)
It’s a little hard for me to test right now as my bots use the old chat_login scope, so can start raids in their own channels, and any channel their set as an editor for, despite not having the channel_editor scope.
One question though, why do you have so many scopes? analytics:read:games for example is of no use to you unless you’re a registered game developer. It’s considered bad practice to request excessive scopes that you have no legitimate use for.
This isn’t for the final build. I literally added as many scopes as I could to figure out which one allowed a raid, yet it wasn’t working
The actual bot, for most of what I need, doesn’t require any scopes at all, apparently, as it’s posting as the broadcaster.
The channel_editor scope is confusing in this case.
Since you are requesting this scope to make API requests on behalf of another user.
But if the bot is logged in as user “bot” if it can’t use a key scoped to channel “foo” with “channel_editor” since it’s logged into chat as the bot. And there are no related API requests.
Potentially requires more testing, but it might just be preferrable to not initiate a raid progmatically, since you still need to provide the bot, if you want to raise the raid from a bot, with a target to raid, which means you are typing something in somewhere anyway. So it might just be easier to type it into Twitch Chat, rather than to type if to your bot, to make your bot type it into twitch chat.
This is generally considered a concern for a lot of broadcasters, they don’t like to give out chat write privileges, generally speaking.
Eventually this will be an issue as, if they are not already, tokens generated here will expire, and you won’t be able to renew them as your will never have this websites client secret. So you will need to look at implementing your own oAuth loop