Discord bot to notify multiple servers (in set channels) when a Twitch streamer goes live. Uses some code (and principles) from fuyuneko's bot
- Active development! Wow!
- Actual functionality!
- Friendly to Twitch APIs, even if they're not!
- Free!
- Open-sourced and auditable by the end user!
- Did I mention? It's free! Apparently I've got the market cornered!
If this is too much horsing around for a single Discord bot, I run an instance of the bot myself. Here's the invite link. AS SOON AS YOU GET IT INVITED INTO YOUR SERVER, PLEASE CONTACT ME FOR THE FINAL SETUP PROCESS. This will no longer be required when I finally get around to implementing the Discord permissions support in the next major version. Keep an eye on this repository for news on that particular front.
- Install basic system utilities
You need tmux or screen, and bash. That's pretty much it.
- Install node
https://nodejs.org/en/download/current/
Note: I run the bot under the latest releases (at time of writing that is v10.9.0) of node, but the LTS release should do just fine.
- Install your dependencies:
npm install Woor/discord.io#gateway_v6 config https
Uses the following libraries:
- Woor's fork of izy521's
discord.io
config
https
- node's internal library
fs
- node's internal library
path
-
Create an application and a bot user for your bot at Discord's developer applications portal then copy in the token to the bot's configuration.
-
Twitch
- Register an application for your bot at twitch: https://dev.twitch.tv/dashboard/apps
- Copy the token (not the client id or the secret!) to the twitch section in
config/default.json
- Keep the interval for checking above 60 seconds to prevent spamming twitch's API too heavily. If you have it set any lower than that, you will not see support of any kind from me.
- Edit the rest of
config/default.json
to your liking, setting your channel and user IDs, nicknames, current game and everything else properly.
Note: Getting IDs for things requires you to turn on 'developer mode' in Discord, under the Appearance tab of User Settings. With this enabled, most things (channels, servers, users) will have an extra selection in their right-click menu you can get the IDs from.
- Start it in a detachable screen/tmux session, using
nodejs discord-twitch-bot.js
inside your multiplexer of choice. - Join it to the servers you want it on (by using the url printed to the bot's console)
- Configure its permissions, making sure it can only recieve messages from those you trust not to mess with the subscribed streams list
- Run the commands:
!setTwitchNotifyChannel <channel ID>
- Make sure the ID here is pointing to a specific channel for Twitch notifications to be posted to. THIS IS REQUIRED or the bot will not function on that server, regardless of how many times you tell it to add or remove streamers from its list! Also, it can only be done by the bot administrator. (This will be improved, and allow anyone with the Administrator permission in Discord to mess with it.) You have to specify the ID, not the fancy link to the channel.!addstream <twitch user>
- Use the username on the end of the URL of their stream, not their user ID or their custom capitalized version.
screech in anger/horror/revulsion as Twitch's APIs cause it to crash repeatedly- You're good to go!
Known caveat: currently the bot has no way of checking for administrative permissions on Discord, so anyone who shares a channel and can message to that channel with the bot in it can control the subscribed streamers list. This will be corrected in the next major version of the bot.
See the !help
and !botmanagement help
commands for further usage.