timcole / WeetBot-V1

Yet another twitch.tv chat bot.
zlib License
1 stars 0 forks source link
chatbot nodejs redis twitch twitchdev twitchtv weetbot

WeetBot

WeetBot is yet another chatbot for twitch.tv

Sub on Twitch Donate


Current features:
TODO:

Setup

$ git clone git@github.com:TimothyCole/WeetBot-Twitch-Chatbot.git
$ cd WeetBot-Twitch-Chatbot
$ npm install
$ cp config.sample.js config.js
$ cp .env.sample .env
$ vim config.js
$ vim .env

Config

Fill out config.js with your information and commands.

credentials: (Required | Object)

channels: (Required | Array of Strings | Start with #)

commands: (Required | Array of Objects)


Run

$ npm start

Making a Command Module

Command modules must be ran inside modules/commands/.

Logging
const log = require('../log.js');

log.pass("Green Plus!");
log.warn("Yellow Tilde!");
log.error("Red Hyphen!");
log.critical("Red Exclamation Mark!"); // KILLS PROCESS

Production modules shouldn't use console.log()

Trigger

Command modules must incude a trigger export with adata param that will be called on a command.
data.client: (Object | tmi.js connecton)
data.channel: (String)
data.userstate: (String | Chatter Infomation)
data.message: (String)

Example Command Module - modules/commands/example.js
const log = require('../log.js');
const color = require("colors/safe");

var exports = module.exports = {};

exports.trigger = (data) => {
    data.client.say(data.channel, `Hey there @${data.userstate.name}!`);
    log.pass(`Said ${color.cyan("hello")} to ${color.cyan(data.userstate.name)}.`);
};
Example Command Module Config
{
    "command": "!hello",
    "module": "example"
}

Redis command module

Example Config
{
    command: "*",
    method: "checkCommand",
    module: "redis"
},
{
    command: "!addcom",
    method: "addCommand",
    module: "redis"
},
{
    command: "!delcom",
    method: "removeCommand",
    module: "redis"
},
{
    command: "!commands",
    method: "getCommands",
    module: "redis"
}

Uptime command module

Required: client_id

Example Config
{
    command: "!uptime",
    module: "uptime"
}