Skip to content

Latest commit

 

History

History
92 lines (69 loc) · 3.46 KB

README.md

File metadata and controls

92 lines (69 loc) · 3.46 KB

ITS_CHAD_BOT

Twitch chat-bot written in Typescript.

Bot Commands

Command Description Required Permission
!debug printlog Print the chat-log. Streamer or Mod
!debug clear Clear the chat-log. Streamer or Mod
!debug printconfig Print the config. Streamer or Mod
!debug banbots Ban bots specified in ./config/twitch_bots.txt. Streamer or Mod
!nuke <word> <minutes> Ban users who used a specified word in the specified number of minutes. Streamer or Mod

Disclaimer

This bot only stores the last hour of chat-logs.

How to run

Requires: Node JS

  1. Open a terminal in the bot's path.
  2. Run the following command: npm install
  3. Create .env in your bot's path.
  4. Configure the bot.
  5. Run using the desired Run Command(s):

Run Commands

Run Command Description
npm start Compile and Run Bot
npm run compile Compile
npm run bot Run without Compiling
npm run dev Compile and Run Bot
npm run dev-host Compile and Run Bot and Run Webserver
npm run host Run Bot and Run Webserver without Compiling

Config File

./config/blacklisted_phrases.txt - Line separated phrases to blacklist.

./config/whitelisted_symbols.txt - No separator needed, symbols to whitelist.

./config/twitch_bots.txt - Line separated usernames to ban.

Creating the Environment File

Navigate to the root folder of the project, and create a file called .env

Inside this file, insert the following:

bot_username = "my_bot_username"
bot_oauth_token = "oauth_token_no_prefix"
channels = "channel1 channel2 channel3"

Next, replace and populate the placeholder values.

Note:

  • The OAuth Token does not need the oauth: prefix.
  • The channels list should be space separated.

Creating New Commands

  1. Navigate to ./src/commands/
  2. Create a Typescript file command.ts
  3. Implement the ICommand interface:
    import tmi = require('tmi.js');
    export class command implements ICommand {
        name: string = "command";
        hasPermission(channel: string, tags: tmi.ChatUserstate): boolean {
            return true;
        }
        run(channel: string, tags: tmi.ChatUserstate, message: string, commandArgs: string[]): void {
            console.log(tags.username + " used the new command!");
        }
    }
  1. Register the command in the command registry: ./src/commandRegistry.ts
    import { command } from "./commands/command";

    ...
    registerCommand(new command());
  1. Done! Your command is now registered.

License

ITS_CHAD_BOT is licensed under the MIT License. Dependencies are under their respective licenses.