๐ค A simple, customizable Discord bot that announces Twitch streams going live (plus a bunch of silly extras).
- ๐ข Monitor and announce Twitch channels going live with customizable
@mentions
. - ๐ด Live stream card that is automatically updated with the stream status, current game and viewership statistics.
You have two options:
-
You can invite the instance I'm running to your server for monotonetim's twitch channels (it announces to
#stream-announcements
). This bot may not always be available, and it may do silly extra things sometimes. -
Or, run your own copy by following the instructions below, and customize it however you want.
This bot is built on Node.js. If you do not yet have Node installed, download and install the latest LTS version from the official website for your platform:
https://nodejs.org/en/download/
I recommend Node v10+.
To set up Timbot, download the latest repository ZIP or clone it using git
:
git clone [email protected]:roydejong/timbot.git
Once installed, enter the directory and install the dependencies:
cd timbot
npm install
Note that you will need to set up some external applications:
Your Discord bot needs to be registered as an application, and you will need a bot token (discord_bot_token
in Timbot config).
Follow this guide for more information.
To connect to the Twitch API, you will need to register a new application in the Twitch Developers Console.
You will need to grab the Client ID (twitch_client_id
in Timbot config).
To make things more complicated, all requests to the Twitch API need to be authenticated with an OAuth grant generated by your own application.
To begin the authorization flow, you'll need to complete the authorization prompt yourself:
https://id.twitch.tv/oauth2/authorize?client_id=<YOUR_CLIENT_ID_HERE>&response_type=token&redirect_uri=http://localhost
You can grab the access_token
from the redirect URL in your browser, and store it as twitch_oauth_token
in Timbot config.
To configure Timbot, copy the included config-sample.json
to config.json
and enter or customize the values in the file.
{
"twitch_channels": "<SOME_TWITCH_CHANNEL_NAME>,<SOME_TWITCH_CHANNEL_NAME>",
"discord_announce_channel": "stream-announcements",
"discord_mentions": {
"<SOME_TWITCH_CHANNEL_NAME>": "everyone",
"<SOME_TWITCH_CHANNEL_NAME>": "here"
},
"discord_bot_token": "<SET_ME>",
"twitch_client_id": "<SET_ME>",
"twitch_oauth_token": "<SET_ME>",
"twitch_check_interval_ms": 60000,
"twitch_use_boxart": true
}
Configuration options explained:
Key | Required? | Description |
---|---|---|
twitch_channels |
โ | Comma-separated list of all channels you want to monitor and send live notifications for. |
discord_announce_channel |
โ | Channel name to post stream announcements in. Make sure the bot has permissions to post here. |
discord_mentions |
This maps channel names to the Discord @ you want to send, such as a role or everyone . If a channel is missing here, no @ is used. Note: once the message is updated, the @ is always removed to prevent spamming users with notifications. |
|
discord_bot_token |
โ | Your bot token, via Discord developer portal. |
twitch_client_id |
โ | Client ID for your Twitch app, via developer portal. |
twitch_oauth_token |
โ | OAuth token that grants access to your Twitch app, via id.twitch.tv as explained above. |
twitch_check_interval_ms |
How often to poll the Twitch API and send or update live embeds. | |
twitch_use_boxart |
If true, use alternate Live Embed style that includes game boxart as a thumbnail image if available. |
Once the application has been configured, start it using node
from the installation directory:
node .
Send the following link to the admin of a Discord server to let them invite the Bot:
https://discordapp.com/oauth2/authorize?client_id=BOT_CLIENT_ID&scope=bot
Swap BOT_CLIENT_ID
in the URL above for your Discord app's client id, which you can find in the app details.