codelinered/twitch-chatbot

Twitch Chatbot made with Vue Skeleton

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 2

Forks: 0

Open Issues: 0

Language:JavaScript

Type:project

1.16.0 2024-04-13 05:58 UTC

This package is auto-updated.

Last update: 2024-04-13 17:52:18 UTC


README

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
Login Web UI Adminer
Server localhost:3050 127.0.0.1
Username - -
Password - -
Database - ../data/chatbot.sqlite3

chatbot.js Options

Option Description
--help, -h Shows list of options
--version Show version number
--recordchat, --rc Record chat messages in database (default: true)
--showversion, --sv Display version text in console (default: true)
--intro, -i Display intro in console (default: true)

Project Commands

Description
gulp watch files and start BrowserSync
gulp build executes following tasks: cleanUp, scss, scssLint, js, jsLint, jsRequire, json, img, font, svg, vue, vueLint, vueJs, vueJsLint
gulp lintAll executes following tasks: scssLint, jsLint, vueJsLint, vueLint, chatbotLint
gulp cleanUp clean up public folder
gulp font copy font files
gulp img copy and compress images
gulp js uglify, minify and concat js files
gulp jsLint checks js follows lint rules
gulp jsRequire copy, uglify and rename files for requirejs
gulp json copy and minify json files
gulp scss compile, minify and concat scss files
gulp scssLint checks scss follows lint rules
gulp svg copy and compress svg files
gulp vue transpile vue files
gulp vueLint checks vue follows lint rules
gulp vueJs transpile vue js files
gulp vueJsLint checks vue js follows lint rules
gulp chatbotLint checks chatbot js follows lint rules
gulp watch watch scss, js, json, vue, chatbot, img, font and svg files

Ports

Description
3000 Web UI with HTML (BrowserSync)
3001 BrowserSync UI
3050 Web UI with PHP/ twitch-chatbot (Docker Container)
3060 Host for twitch-chatbot-videos-folder (Docker Container)
3100 Main Window (Skateboard Socket for Web UI)
3110 Chat Window (Skateboard Socket for Web UI)
3120 Player Window (Skateboard Socket for Web UI)
3130 Raffle Window (Skateboard Socket for Web UI)
3140 Poll Window (Skateboard Socket for Web UI)
3150 Counter Window (Skateboard Socket for Web UI)

chatbot.json

Description
username Required - Twitch User Name
tmiToken Required - Twitch TMI Token
clientIdToken Optional - Twitch Client ID Token (is presetted)
youtubeToken Optional - YouTube API Token
videosFolder Optional - Absolute path to videos folder with trailing slash
backup Optional - Daily backup yes or no
performance Optional - 0 = low / 1 = high
locale Required - German (de) and English (en) are presetted
channels Required - List of Channels to connect

gulpfile.json

Description
browserSyncConfig Required - Defines which config is used for BrowserSync (default: browserSyncDev)
sourcePath Required - Path to raw files (default: src/)
publicPath Required - Path to transpiled files (default: public/)
env Required - Environment dev, test or prod (default: dev)

Chatbot Commands

Name Command
about !about, !chatbot, !cb, !bug, !bugs, !help
commands !commands, !cc
counter counter 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
raffle custom keyword (default: !raffle)
rollDice !d6 or !d56w6 - first digit can be from 1 - 99 and second from 1 - 9
customCommand wrapper for all custom commands
Mention User (NEW) !yourcommand @UserName

Chatbot Commands for Streamer and Moderators

Name Command
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

Option Description
--on Enable command for all users (default: true, if is a new command)
--off Disable command for all users, but not streamer and mods (default: false)
--cd 30 Cooldown for all users, but not streamer and mods (default: 30 seconds, if is a new command)
--st Show command status in chat (default: false)
--rm Remove command (default: false)

Bot List Options for Streamer and Moderators

Option Description
--tc Show bot list to chat (default: false)
--rm Remove 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

Player Name Sub Name Duration
Local Yes1 (Parsed File Name) Yes (Modification Date) Yes
Twitch Clip Yes (Clip Title) Yes (Game/ Category) Yes
Twitch Video Yes (Video Title) Yes (Game/ Category) Yes
YouTube Video Yes (Video Title) Yes (First Video Tag) Yes

1 example_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

import-videos-folder.js Options

Option Description
--help, -h Shows list of options
--version Show version number
--backup, -b Optional - Create an additional backup (default: false)
--channel, -c Required - Channel name which owns the videos
--identity, -i Optional - Channel id / Room id. (required if channel is not in database)
--locale, -l Optional - Locale to use in date generation and log messages (default: en)
--log Optional - Show logs in CLI (default: true)
--subname, --sn Optional - 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

Option Description
--help, -h Shows list of options
--version Show version number
--direction, -d Optional - Migration direction (default: up)
--file, -f Optional - Execute one specific migration file (e.g.: -f version-1.0.0)
--locale, -l Optional - Locale for log messages (default: en)
--log Optional - 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