All Projects → kritzware → node-twitchbot

kritzware / node-twitchbot

Licence: MIT license
Package for easily creating Twitch Bots

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to node-twitchbot

Harmonbot
Multi-Platform Factotum Bot
Stars: ✭ 30 (+130.77%)
Mutual labels:  twitch, twitchbot, twitch-irc
twitch2dcs
DCS World mod that allows twitch chat to be viewed inside the game
Stars: ✭ 24 (+84.62%)
Mutual labels:  twitch, twitch-irc
TwitchFollowers
Twitch followers discord bot. (TwitchFarmer)
Stars: ✭ 72 (+453.85%)
Mutual labels:  twitch, twitchbot
TwitchBot
Custom C# chat bot for Twitch TV
Stars: ✭ 33 (+153.85%)
Mutual labels:  twitch, twitch-irc
TwitchMarkovChain
Twitch Bot for generating messages based on what it learned from chat
Stars: ✭ 87 (+569.23%)
Mutual labels:  twitch, twitchbot
twitchtube
Twitch YouTube bot. Automatically make video compilations of the most viewed Twitch clips and upload them to YouTube using Python 3.
Stars: ✭ 398 (+2961.54%)
Mutual labels:  twitch, twitchbot
Twitch Js
A community-centric, community-supported version of tmi.js
Stars: ✭ 225 (+1630.77%)
Mutual labels:  twitch
CounterStrike-GlobalOffensive-LiveStat-for-OBS-Studio
Showing you LIVEstats of CS:GO in your Stream like OBS-Studio while playing/streaming.
Stars: ✭ 24 (+84.62%)
Mutual labels:  twitch
All In One Customized Adblock List
An all-in-one adblock list that thoroughly blocks trackers, popup ads, ads, unwanted cookies, fake news, cookie warning messages, typosquatters, unwanted comment sections, crypto-coin mining, YouTube clutter, Twitter guff and social network hassles.
Stars: ✭ 217 (+1569.23%)
Mutual labels:  twitch
Twitch4j
Modular Async/Sync/Reactive Twitch API Client / IRC Client
Stars: ✭ 209 (+1507.69%)
Mutual labels:  twitch
PhantomBot-German-Translation
Deutsche Übersetzung des Twitch Chat Bots PhantomBot
Stars: ✭ 13 (+0%)
Mutual labels:  twitch
pajbot2
pajbot in go
Stars: ✭ 79 (+507.69%)
Mutual labels:  twitch
elm-twitch-chat
Elm powered Twitch chat using WebSockets
Stars: ✭ 14 (+7.69%)
Mutual labels:  twitch
Twitch
Interact with Twitch's API, chat, PubSub and subscribe to WebHooks.
Stars: ✭ 237 (+1723.08%)
Mutual labels:  twitch
extensions-js
An Easier way to build Twitch Extensions using this JavaScript library for interfacing with Muxy's extensions backend.
Stars: ✭ 26 (+100%)
Mutual labels:  twitch
Transport Eta
Twitch streamed 🎥playground repo, README speaks to you.
Stars: ✭ 223 (+1615.38%)
Mutual labels:  twitch
streamcord
A Discord bot that interacts with the popular streaming service Twitch.tv
Stars: ✭ 83 (+538.46%)
Mutual labels:  twitch
Awesome Live Coding Streams
Stars: ✭ 216 (+1561.54%)
Mutual labels:  twitch
Cracking The Coding Interview Rust
Cracking the Coding Interview problem solutions in Rust
Stars: ✭ 246 (+1792.31%)
Mutual labels:  twitch
Streamlabs Obs
Free and open source streaming software built on OBS and Electron.
Stars: ✭ 3,473 (+26615.38%)
Mutual labels:  twitch

node-twitchbot Build Status

NOTE: This package has been discontinued. It is highly recommend to use the new version at kritzware/twitch-bot

This package is not to be used for Twitch botting (inflating live viewer counts) and should only be used for chatbots. Attempting to 'bot' a Twitch channel can lead to your account being permanently banned.

Installation

Version 2.0.0^ (Recommended):

$ npm install node-twitchbot

Version 1 (Deprecated):

$ npm install [email protected]

V2 DOCS

Example

const TwitchBot = require('node-twitchbot')

const Bot = new TwitchBot({
  username : 'GLADOS',
  oauth    : 'oauth:secret-oauth-pass',
  channel  : 'Aperture'
})

/* Connect bot to Twitch IRC */
Bot.connect()
.then(() => {

  /* Listen for all messages in channel */
  Bot.listen((err, chatter) => {
    if(err) {
      console.log(err)
    } else {
      console.log(chatter.msg) // 'Hello World!'
    }
  })

  /* Listen for an exact messages match */
  Bot.listenFor('KKona', (err, chatter) => {
    console.log(chatter)
  })

  /* Send a message in the channel */
  Bot.msg('this is the message text PogChamp')

  /* Listen for raw IRC events */
  Bot.raw((err, event) => {
    console.log(event)
  })
})
.catch(err => {
  console.log('Connection error!')
  console.log(err)
})

Chatter Object

Most callbacks return a chatter object which contains the following attributes:

{
  user: 'kritzware',
  msg: 'Hello world! Kappa',
  channel: 'kritzware',
  twitch_id: '44667418',
  level: 'mod',
  sub: 0,
  turbo: 0
}

V1 DOCS

Example

const Bot = require('node-twitchbot')

Bot.run({
username: 'bot_username',
  oauth: 'oauth:twitch_oauth_key',
  channel: 'channel'
})

/* Exact message match */
Bot.listenFor('Kappa', (err, chatter) => {
  if(err) {
    console.log(err)
  } else {
    console.log(chatter)
  }
})

/* Return all user message in channel */
Bot.listenFor('*', (err, chatter) {
  // Returns all viewer messages in channel
})

/* String is included in message */
Bot.listen('PogChamp', (err, chatter) => {
  console.log(chatter)
})

/* Sub/resub event in chat */
Bot.resub((err, chatter, sub) => {
  console.log(sub)
})

/* Say messages in chat */
Bot.msg('Hello chat!')

/* Private message user */
Bot.whisper('kritzware', 'This is a private message Kappa')

/* Setting commands instead of checking via string match */
const commands = {
  help : 'For help using this bot, contact kritzware',
  twitter : 'Follow this channel at https://twitter.com/test123',
  /* You can also use functions to generate a command response */
  random : (chatter) => {
    return Math.floor((Math.random() * -1) + 1)
  },
  /* Command functions can make use of the chatter object of the user who executed the command */
  goodnight : (chatter) => {
    return 'Goodnight ' + chatter.user + '! FeelsGoodMan'
  }
}

Bot.commands('!', commands, (err, chatter, command) => {
  if(err) {
    console.log(err)
  } else {
    console.log(command)
    console.log(chatter)
  }
})

Output for example '!goodnight' command above

Example of a command

Bot.listenFor('!command', (err, chatter) => {
  Bot.msg('This is the command response')
})
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].