Skip to content

Repository files navigation

Twitch Chatbot - CodelineRed

Visit screenshots for an inside look.

This application based on Vue Skeleton (1.x).

This software is meant to be installed on your local machine. If you want to install on a public web server, please secure public folder by .htpasswd or something similar.

Table of contents

Included

Install Production Build (Recommended)

Required

Open console on your OS and navigate to the place where you want to install the project.

With Composer

php composer create-project --ignore-platform-reqs --no-dev codelinered/twitch-chatbot twitch-chatbot "dev-production"cd twitch-chatbot
npm i --only=prod

Add username, tmiToken, your channel and other channels to src/app/chatbot.json

node migration.js
node chatbot.js

With GIT

git clone https://github.com/CodelineRed/twitch-chatbot.git
cd twitch-chatbot
git checkout production
npm i --only=prod

Add username, tmiToken, your channel and other channels to src/app/chatbot.json

node migration.js
node chatbot.js

With ZIP

Unix

wget -O tcb-prod.zip https://github.com/CodelineRed/twitch-chatbot/archive/production.zip
unzip tcb-prod.zip

Windows 10+

curl -L -o tcb-prod.zip https://github.com/CodelineRed/twitch-chatbot/archive/production.zip
tar -xf tcb-prod.zip

All OS

cd twitch-chatbot-production
npm i --only=prod

Add username, tmiToken, your channel and other channels to src/app/chatbot.json

node migration.js
node chatbot.js

Generate tmiToken and click on "Connect".
If you need PHP, you have to go to Install with Docker.

Install Main/ Develop Build

Required

Open 2 consoles on your OS and navigate to the place where you want to install the project.

With Composer

php composer create-project --ignore-platform-reqs codelinered/twitch-chatbot twitch-chatbot
cd twitch-chatbot
npm i
gulp build

Add username, tmiToken, your channel and other channels to src/app/chatbot.json

node migration.js
node chatbot.js

in 2nd console

gulp

With GIT

git clone https://github.com/CodelineRed/twitch-chatbot.git
cd twitch-chatbot
git checkout main
npm i
gulp build

Add username, tmiToken, your channel and other channels to src/app/chatbot.json

node migration.js
node chatbot.js

in 2nd console

gulp

With ZIP

Unix

wget -O tcb-main.zip https://github.com/CodelineRed/twitch-chatbot/archive/main.zip
unzip tcb-main.zip

Windows 10+

curl -L -o tcb-main.zip https://github.com/CodelineRed/twitch-chatbot/archive/main.zip
tar -xf tcb-main.zip

All OS

cd twitch-chatbot-main
npm i
gulp build

Add username, tmiToken, your channel and other channels to src/app/chatbot.json

node migration.js
node chatbot.js

in 2nd console

gulp

Generate tmiToken and click on "Connect".
Open localhost:3000 for Web UI.

Install with Docker (optional)

Required

Open console on your OS and navigate to the unzipped or cloned app folder.

Unix

systemctl docker start
docker-compose up -d
docker run --rm --interactive --tty --volume $PWD:/app composer install --no-dev
docker exec -ti twitch-chatbot php /var/www/vendor/vrana/adminer/compile.php
-- Ignore error messages --
mv adminer-4.6.2.php ./adminer

Windows 10+

"c:\path\to\Docker Desktop.exe"
docker-compose up -d
docker run --rm --interactive --tty --volume %cd%:/app composer install --no-dev
docker exec -ti twitch-chatbot php /var/www/vendor/vrana/adminer/compile.php
-- Ignore error messages --
move adminer-4.6.2.php ./adminer

All OS

$ npm i
$ gulp build
$ node migration.js
$ node chatbot.js
LoginWeb UIAdminer
Serverlocalhost:3050127.0.0.1
Username--
Password--
Database-../data/chatbot.sqlite3

chatbot.js Options

OptionDescription
--help, -hShows list of options
--versionShow version number
--recordchat, --rcRecord chat messages in database (default: true)
--showversion, --svDisplay version text in console (default: true)
--intro, -iDisplay intro in console (default: true)

Project Commands

Description
gulpwatch files and start BrowserSync
gulp buildexecutes following tasks: cleanUp, scss, scssLint, js, jsLint, jsRequire, json, img, font, svg, vue, vueLint, vueJs, vueJsLint
gulp lintAllexecutes following tasks: scssLint, jsLint, vueJsLint, vueLint, chatbotLint
gulp cleanUpclean up public folder
gulp fontcopy font files
gulp imgcopy and compress images
gulp jsuglify, minify and concat js files
gulp jsLintchecks js follows lint rules
gulp jsRequirecopy, uglify and rename files for requirejs
gulp jsoncopy and minify json files
gulp scsscompile, minify and concat scss files
gulp scssLintchecks scss follows lint rules
gulp svgcopy and compress svg files
gulp vuetranspile vue files
gulp vueLintchecks vue follows lint rules
gulp vueJstranspile vue js files
gulp vueJsLintchecks vue js follows lint rules
gulp chatbotLintchecks chatbot js follows lint rules
gulp watchwatch scss, js, json, vue, chatbot, img, font and svg files

Ports

Description
3000Web UI with HTML (BrowserSync)
3001BrowserSync UI
3050Web UI with PHP/ twitch-chatbot (Docker Container)
3060Host for twitch-chatbot-videos-folder (Docker Container)
3100Main Window (Skateboard Socket for Web UI)
3110Chat Window (Skateboard Socket for Web UI)
3120Player Window (Skateboard Socket for Web UI)
3130Raffle Window (Skateboard Socket for Web UI)
3140Poll Window (Skateboard Socket for Web UI)
3150Counter Window (Skateboard Socket for Web UI)
Description
usernameRequired - Twitch User Name
tmiTokenRequired - Twitch TMI Token
clientIdTokenOptional - Twitch Client ID Token (is presetted)
youtubeTokenOptional - YouTube API Token
videosFolderOptional - Absolute path to videos folder with trailing slash
backupOptional - Daily backup yes or no
performanceOptional - 0 = low / 1 = high
localeRequired - German (de) and English (en) are presetted
channelsRequired - List of Channels to connect
Description
browserSyncConfigRequired - Defines which config is used for BrowserSync (default: browserSyncDev)
sourcePathRequired - Path to raw files (default: src/)
publicPathRequired - Path to transpiled files (default: public/)
envRequired - Environment dev, test or prod (default: dev)

Chatbot Commands

NameCommand
about!about, !chatbot, !cb, !bug, !bugs, !help
commands!commands, !cc
countercounter increased if users counts from 1 - X without interruption
diceDuel!dd6 @User or !dd56w6 @User - first digit can be from 1 - 99 and second from 1 - 9 (automatically removed after 120 sec)
diceDuelAccept!dda - accepting a dice duel request
playlistInfo!plan, !program, !playlist, !video
poll!vote 1 - X
rafflecustom keyword (default: !raffle)
rollDice!d6 or !d56w6 - first digit can be from 1 - 99 and second from 1 - 9
customCommandwrapper for all custom commands
Mention User(NEW) !yourcommand @UserName

Chatbot Commands for Streamer and Moderators

NameCommand
Custom Command(NEW) !yourcommand [Hello World!] [OPTIONS]
Bot List(NEW) !bots [BotName] [OPTIONS]
addBot(Deprecated) !addbot BotName
removeBot(Deprecated) !rmbot BotName
addCustomCommand(Deprecated) !addcc !command[@cooldown] lorem ipsum e.g. !addcc !hw@10 hello world
removeCustomCommand(Deprecated) !rmcc !command
toggleCustomCommand(Deprecated) !tglcc !command
updateCustomCommand(Deprecated) !updcc !command[@cooldown] lorem ipsum dolor e.g. !updcc !hw Hello World!

Custom Command Options for Streamer and Moderators

OptionDescription
--onEnable command for all users (default: true, if is a new command)
--offDisable command for all users, but not streamer and mods (default: false)
--cd 30Cooldown for all users, but not streamer and mods (default: 30 seconds, if is a new command)
--stShow command status in chat (default: false)
--rmRemove command (default: false)

Bot List Options for Streamer and Moderators

OptionDescription
--tcShow bot list to chat (default: false)
--rmRemove bot (default: false)

Web UI Features

Chat

  • Timestamp
  • Badges
  • Custom User Color
  • "/me" Messages in full color and italic style
  • Cheers
  • Subs, Resubs, Sub Gifts (random and specific), Gift Upgrades
  • Bans, Timeouts, Deletes
  • Now Hosting, Hosted By, Raided By, Unhost
  • Clickable Links
  • Twitch Emotes
  • BetterTTV Emotes
  • FrankerFaceZ Emotes
  • Popout URL /channel/[channel]/chat to use browser source in OBS (No pixel recommendation)

Commands

  • Cooldown
  • Active State
  • Last Execution Time

Custom Commands

  • Add Command (only in chat)
  • Remove Command
  • Toggle Command
  • Update Command (only in chat)

Counter

  • Popout URL /channel/[channel]/counter to use browser source in OBS (Pixel recommendation: 400x400px)

Playlist

  • Play Local MP4 files with localhost:3060 domain. (See docker-compose.videos-folder.yml)
  • Play Twitch Clips and Videos (past broadcasts, highlights and video uploads)
  • Play YouTube Videos
  • Add Video
  • Edit Video
  • Skip Videos
  • Move Videos
  • Remove Video
  • Remove Played Videos
  • Remove Skipped Videos
  • Add Playlist
  • All Playlists
  • Edit Playlist
  • Switch Playlist
  • Merge Playlists
  • Remove Playlist
  • Reset Playlist
  • Clear Playlist
  • playlistInfo Command
  • Popout URL /channel/[channel]/player to use browser source in OBS (Pixel recommendation: 1920x1080px)
  • Video name overlay in player
  • Autofill video name, sub name and duration (Depence on videosFolder, youtubeToken and clientIdToken settings)
  • Change stream title and / or game dynamic (If at least one Twitch account is connected to "Insanity Meets - Chatbot" App on Twitch)

Autofill

PlayerNameSub NameDuration
LocalYes1 (Parsed File Name)Yes (Modification Date)Yes
Twitch ClipYes (Clip Title)Yes (Game/ Category)Yes
Twitch VideoYes (Video Title)Yes (Game/ Category)Yes
YouTube VideoYes (Video Title)Yes (First Video Tag)Yes

1example_video-2020.mp4 parsed to Example Video - 2020

Poll

  • Start Poll
  • Close Poll
  • Remove Poll
  • Copy Poll to Form
  • All Polls Modal
  • Announce Poll to Chat Button
  • Result to Chat Button
  • Animate Winner (If multiple options are equal than a random winner will be picked)
  • Play Audio for Winner (Audio is only played in popout window)
  • Play Audio loop for Poll (Audio is only played in popout window)
  • Announce Winner to Chat
  • Multiple Choice Yes/No
  • Combine Poll with Raffle
  • Start Datetime
  • End Datetime
  • Datime Picker
  • Popout URL /channel/[channel]/poll to use browser source in OBS (Pixel recommendation: 1000x563px by max. 6 options)

Raffle

  • Start Raffle
  • Close Raffle
  • Remove Raffle
  • Copy Raffle to Form
  • All Raffles Modal
  • Announce Raffle to Chat Button
  • Result to Chat Button
  • Animate Winner
  • Play Audio for Winner (Audio is only played in popout window)
  • Play Audio loop for Poll (Audio is only played in popout window)
  • Announce Winner to Chat
  • Custom Keyword
  • Multiplicators
  • Start Datetime
  • End Datetime
  • Datime Picker
  • Popout URL /channel/[channel]/raffle to use browser source in OBS (Pixel recommendation: 1000x563px)

Bots

  • Own badge in Chat
  • Preset of 5 Bots (Mod4YouBot, Moobot, Nightbot, StreamElements, Streamlabs)
  • Bot autofilling with BetterTTV API

Statistics

  • Display Viewer Count as Chart
  • Top 15 Emotes All
  • Top 15 Twitch Emotes
  • Top 15 BTTV Emotes
  • Top 15 FFZ Emotes
  • Top 15 Chatters
  • Top 15 Hashtags
  • Top 15 Commands
  • Amount of Subs
  • Amount of New Subs
  • Amount of New Paid Subs
  • Amount of New Prime Subs
  • Amount of Gifted Directly Subs
  • Amount of Gifted Random Subs
  • Amount of Resubs
  • Amount of Paid Resubs
  • Amount of Prime Resubs
  • Amount of Purges
  • Amount of Deleted Messages
  • Amount of Timeout Meassages
  • Amount of Timeout Users
  • Amount of Banned Users
  • Amount of New Users
  • Amount of All Users
  • Amount of Chat Messages
  • Amount of Used Emotes
  • Amount of Cheers
  • Amount of Bits
  • Viewer Minimum
  • Viewer Maximum
  • Viewer Average
OptionDescription
--help, -hShows list of options
--versionShow version number
--backup, -bOptional - Create an additional backup (default: false)
--channel, -cRequired - Channel name which owns the videos
--identity, -iOptional - Channel id / Room id. (required if channel is not in database)
--locale, -lOptional - Locale to use in date generation and log messages (default: en)
--logOptional - Show logs in CLI (default: true)
--subname, --snOptional - Add date as sub name (default: true)

Example execution: node import-videos-folder.js -c CodelineRed

Import Requirements:

  • videosFolder in chatbot.json points to existing folder
  • each folder under videosFolder corresponds to a playlist
  • only MP4 files are allowed

The Script only imports videos which are not in the database.

migration.js Options

OptionDescription
--help, -hShows list of options
--versionShow version number
--direction, -dOptional - Migration direction (default: up)
--file, -fOptional - Execute one specific migration file (e.g.: -f version-1.0.0)
--locale, -lOptional - Locale for log messages (default: en)
--logOptional - Show logs in CLI (default: true)

Example execution: node migration.js -d up

Localization

Links

Audio Files

Known Issues

  • Sometimes user are not inserted in channel_user_join. This is under investigation.
  • Emotes in Chat component can flicker after new message was added
  • An Emoji followed by a Twitch emote (e.g. 🧡 CoolCat) is wrong interpreted by emote.encodeTwitch()
    • The API sends a wrong userstate.emotes object

About

Twitch Chatbot made with Vue Skeleton

Topics

Resources

Stars

4 stars

Watchers

1 watching

Forks

Releases

Used by

Contributors

Languages