A Twitch chat bot
We need to set a few environment variables for the bot to be able to auth and connect to a Twitch channel. These can be included in a .env file, which will be imported.
BOT_USERNAME
: Username of the bot's Twitch account
OAUTH_TOKEN
: OAuth token for authentication
CHANNEL_NAMES
: String delimited list of Twitch Channels to join
# Install dependencies
$ npm install
# Serve with nodemon and babel-node for local development
$ npm run dev
# Run webpack build for production
$ npm run build
# Run production app
$ npm run start
Configured in src/config.json
Setting | Type | Description |
---|---|---|
commandPrefix |
string |
The prefix for chat commands e.g. ! or @ or $ |
A set of commands to enable throwing and catching of a pre-defined item between chat members. There's no hidden depth here. It's just for fun.
# To throw an item to be caught
!throw
# To catch the last item that was thrown
!catch
# To throw an item at a chat member
!throw @username
Throw/Catch can be configured in src/config.json
Setting | Type | Description |
---|---|---|
item |
string |
Name of the item to be used. |
An automated take on the popular Battle Royale genre. For a round, current members of chat are the active players. Players will randomly win 1v1 battles against other random players. There is a small chance a player can eliminate themselves. The last player alive is declared the winner.
# To start Battle Royale from Stream chat
!br
- There must be 2 or more players and a game not already in progress.
- The command is streamer-only.
Battle Royale can be configured in src/config.json
Setting | Type | Description |
---|---|---|
prefix |
string |
Chat prefix for the bot messages in chat. |
minMessageWait |
number |
Min time between actions in ms.* |
maxMessageWait |
number |
Max time between actions in ms. |
*Keep minMessageWait
upwards of 1000 or the bots messages will get throttled
This feature asks the bot to pick a random number. By default it rolls between 1 and 100. If you include a number in the command, it will use that number as the max e.g. !roll 500
.
# To roll between 1 and 100
!roll
# To roll between 1 and x e.g. !roll 500
!roll <positive number>