Skip to content

SpeedyFolf/RandomLineCommands

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RandomLineCommands

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.

Requirements

  • Node.js (LTS recommended)
  • A Twitch account for the bot
  • An OAuth token for IRC (see Twitch Chat & IRC or a TMI token generator)

Setup

  1. Clone or download this repository.

  2. Install dependencies:

    npm install
  3. Create a .env file 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 with oauth:.
  4. 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").

  5. 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.

Usage

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.

Search filter

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.

Project layout

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

Adding or changing content

  1. Add or edit a .txt file under lines/ (one response per line).
  2. In index.js, point a variable at the file path (see existing *file variables near the top).
  3. Add a case in the readMessages switch for the command name(s) you want, calling readTheFile(channel, yourFile).

License

This project is licensed under the Do What The Fuck You Want To Public License — see LICENSE.

About

Twitch random line bot commands. A thing that picks a random line of text from a file. Nightbot works on both Twitch and Discord. Mine works in Twitch chat only.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors