Skip to content

CarlosFdez/tmibot.js

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

TMIBot.js

A javascript library that wraps over tmi.js to support bot command parsing. This is really new and highly subject to change. Some ideas came from various discord bot libraries (mostly discord.py).

I wrote this mostly for my own use, but if you want feel free to use it. You can contact me on Twitter if you need anything.

How to install

Its currently not on NPM, so you'd have to do:

npm install https://github.com/CarlosFdez/tmibot.js.git

Example

var tmi = require("tmi.js");
var tmibot = require("tmibot.js");

// note: it is good practice not to include config files in source control
var config = require("./config.json");

// config options are the same as normal tmi.client
var client = new tmi.client(config.tmi);
var bot = new tmibot.bot(client, { prefix: '!' });

bot.addCommand("hello", (ctx, args) => {
    ctx.reply("Hello " + ctx.author.name);
});

bot.addCommand("echo", (ctx, args) => {
    ctx.reply(args.toString());
})

client.connect();

More examples are in the examples/ folder.

Documentation

Unfortunately there isn't any at this time. However, I did write JSDoc comments, so an editor with intelligent code completion is enough. I personally use Visual Studio Code.

About

A wrapper for tmi.js to support bot commands for twitch

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published