A collection of utilities and tools for Twitch streamers
This project includes a Twitch chatbot and some overlays used in my Twitch channel (tinarskii). Inspired by thananon/twitch_tools and lucidkarn/luciabot. The project is written in TypeScript and uses Bun instead of Node.js, many features may be unavailable or not working as expected if you are not using Bun.
-
Moderation
Announce
- Announce a message to the chatGame
- Change stream's gameShoutout
- Shoutout a userStream
- Change stream's title
-
Capitalism
Balance
- Check your balanceDaily
- Claim your daily rewardGamble
- Gamble your moneyGive
- Give money to another userWeekly
- Claim your weekly reward
-
Miscellaneous
Eat
- Chose a random food to eatHate
- How much do you hate someone?Help
- Show help messageLove
- How much do you love someone?Stomp
- Stomp on someone
-
Overlay & Customization
Nickname
- Change your nickname (Linked with the chat overlay)
-
Song Request
Song-Queue (sq)
- Show the music queueSong-Remove (rm)
- Remove a song from the queueSong-Skip (sk)
- Skip the current songSong-Request (sr)
- Add a song to the queueSong-Playing (np)
- Show the current song
Chat Overlay
- Show chat messages on the stream (Nickname command linked)Event Feed
- Show recent events on the stream (Linked with economic commands)Music Player
- Play music on the stream (Click now-playing box to hide the video)Music Queue
- Show the music queue on the stream (Linked with the music player)
- Bun (Version 1.0.0 or higher is recommended)
- Twitch Developer Account (For the chatbot)
- Clone the repository
git clone https://github.com/tinarskii/twitch-utils.git
cd twitch-utils
- Install dependencies
bun install
- Rename a
.env.example
file to.env
in the root directory, the file content should be something like this:
CLIENT_ID= # Read FAQ to get your creditentials
CLIENT_SECRET= # Read FAQ to get your creditentials
USER_ACCESS_TOKEN= # Read FAQ to get your creditentials
REFRESH_TOKEN= # Read FAQ to get your creditentials
BROADCASTER_ACCESS_TOKEN= # Read FAQ to get your creditentials
BROADCASTER_REFRESH_TOKEN= # Read FAQ to get your creditentials
TW_CHANNEL= # Your channel name that wants the bot to connect to
TW_ID= # Your bot's channel ID (You can get it from the Twitch API or this site: https://www.streamweasels.com/support/convert-twitch-username-to-user-id)
BROADCASTER_ID= # Your channel ID (You can get it from the Twitch API or this site: https://www.streamweasels.com/support/convert-twitch-username-to-user-id)
NODE_ENV= # Set it to "production" if you are running the bot in production, otherwise prefer "development"
OVERLAY_TOKEN= # A random string to authenticate the overlay (E.g. if token is "abcde", you can access the chatbox at http://localhost:3000/chat?token=abcde)
- Start the bot
bun start
- Download the latest installer from the releases page.
- Run
installer.bat
file (Windows) orinstaller.sh
file (Linux/MacOS) to install the project.
If you want to contribute to the project, please read the CONTRIBUTING.md file. However, if you have any questions, feel free to ask in the Discord server.
This project is licensed under the Mozilla Public License 2.0.
You can get your Twitch API credentials by creating a new application (not extensions) in
the Twitch Developer Portal. Set "OAuth Redirect URL" to http://localhost:3000/
, set the category
to "Chat Bot" and client type to "Confidential". After that, you will be redirected to the application page.
Get your client ID and client secret from the application's dashboard, and add them to your .env
file.
After that, you can install TwitchCLI and run the following command to get your
access token:
twitch token -u -s "user:edit user:read:email chat:read chat:edit channel:moderate moderation:read moderator:manage:shoutouts moderator:manage:announcements channel:manage:moderators channel:manage:broadcast channel:read:vips channel:read:subscriptions channel:manage:vips channel:read:redemptions channel:manage:redemptions moderator:read:followers bits:read"
You will receive a user access token and a refresh token, add them to your .env
file.
Note: You should run the following command 2 times, once for the bot account and once for the broadcaster account, make sure
to logout of Twitch before running the command again. Put the access token and refresh token in the .env
file accordingly.
These files are used to run the webserver in HTTPS. If you want to use HTTPS, you can generate these files using OpenSSL
or any other tools. If you don't want to use HTTPS, you can remove the server.crt
and server.key
in server/config.ts
.
Currently, Bun is only available for Linux and MacOS. If you are using Windows, you can use WSL or a virtual machine to
run the project.
Bun is now available for Windows, you can follow the official documentation
for the installation.
For further assistance about installing Bun, you may ask in the Bun official Discord server.