A Node.js Twitch chat bot that responds to commands by posting a random line from a text file. Each command maps to a file under lines/ (GTA quotes, animal facts, emojis, channel quotes, and more).
Originally created by Riekelt; maintained by SpeedyFolf.
- Node.js (LTS recommended)
- A Twitch account for the bot
- An OAuth token for IRC (see Twitch Chat & IRC or a TMI token generator)
-
Clone or download this repository.
-
Install dependencies:
npm install
-
Create a
.envfile in the project root (this file is gitignored and must not be committed):TWITCH_USER=your_bot_username_here TWITCH_OAUTH=oauth:your_token_here
TWITCH_USER— the bot’s Twitch login name (lowercase).TWITCH_OAUTH— your IRC password, usually prefixed withoauth:.
-
Edit the channel list in
index.js(OPTIONS.channels) so the bot joins the channels you want. Add or remove entries as needed (e.g."#yourchannel"). -
Start the bot:
node index.js
The bot connects to Twitch chat via tmi.js. Uncaught errors are logged to crash.log instead of exiting immediately.
Viewers use commands in chat (e.g. !gtasa, !catfact, !8ball). Many commands have aliases; see the switch in index.js or reference files under lines/!Reference/.
A full command list is also linked from lines/Singles/Commands.txt.
You can narrow results before picking a random line. Extra words after the command are used as a case-insensitive substring filter on the file’s lines.
Example:
!gtaiv placeholder
Only lines containing placeholder are considered; one of those is chosen at random. If nothing matches, the bot replies that no quote was found.
| Path | Purpose |
|---|---|
index.js |
Bot logic, command routing, Twitch connection |
.env |
Twitch username and OAuth token (local only) |
lines/ |
One .txt file per command category; one line = one possible response |
lines/!Reference/ |
Examples and reference lists (not loaded by the bot unless wired in) |
lines/Singles/Commands.txt |
Human-readable overview / external command list link |
- Add or edit a
.txtfile underlines/(one response per line). - In
index.js, point a variable at the file path (see existing*filevariables near the top). - Add a
casein thereadMessagesswitchfor the command name(s) you want, callingreadTheFile(channel, yourFile).
This project is licensed under the Do What The Fuck You Want To Public License — see LICENSE.