insanitymeetshh/twitch-chatbot

This package is not installable via Composer 1.x, please make sure you upgrade to Composer 2+. Read more about our Composer 1.x deprecation policy.

Twitch Chatbot made with Vue Skeleton

Installs: 2

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Language:JavaScript

Type:project

1.8.0 2021-02-13 12:17 UTC

This package is auto-updated.

Last update: 2021-07-13 13:25:48 UTC


README

Visit screenshots for an inside look.

This application based on Vue Skeleton.

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

Download zip if you don't have git on your OS. Open console on your OS and navigate to your project folder.

$ git clone https://github.com/InsanityMeetsHH/twitch-chatbot.git
$ cd twitch-chatbot
$ git checkout production
$ (optional on unix) rm -rf .git
$ (optional on windows) rmdir .git /s
$ npm i --only=prod
$ -- Add username, tmiToken and channels to src/app/chatbot.json ---
$ node migration.js
$ node chatbot.js

Generate tmiToken here. If you want to use the Web UI, you have to go to Install PHP, Adminer and Web UI.

Install Master/ Develop Build

Required

Download zip if you don't have git on your OS. Open 2 consoles on your OS and navigate both to your project folder.

$ git clone https://github.com/InsanityMeetsHH/twitch-chatbot.git
$ cd twitch-chatbot
$ (optional) git checkout develop
$ (optional on unix) rm -rf .git
$ (optional on windows) rmdir .git /s
$ npm i
$ gulp build
$ -- Add username, tmiToken and channels to src/app/chatbot.json ---
$ node migration.js
$ node chatbot.js
$ (in 2nd console) gulp

Generate tmiToken here. Open localhost:3000 for Web UI.

Install PHP, Adminer and Web UI (optional)

Required

Open console on your OS and navigate to the unziped/ cloned app folder.

$ (unix) systemctl docker start
$ (windows) "c:\path\to\Docker Desktop.exe"
$ docker-compose up -d

Follow the 4 steps from Command-line installation and replace every leading php with docker exec -ti twitch-chatbot php

$ docker exec -ti twitch-chatbot php composer.phar install
$ docker exec -ti twitch-chatbot php /var/www/vendor/vrana/adminer/compile.php
$ (unix) mv adminer-4.6.2.php adminer/
$ (windows) move adminer-4.6.2.php adminer/
$ node migration.js
$ node chatbot.js

Open localhost:3050 for Web UI or localhost:3050/adminer.php for Database GUI.

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
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 command commands

Chatbot Commands for Broadcaster and Moderators

Name Command
bots !bots [public]
addBot !addbot name
removeBot !rmbot name
addCustomCommand !addcc !command[@cooldown] lorem ipsum e.g. !addcc !hw@10 hello world
removeCustomCommand !rmcc !command
toggleCustomCommand !tglcc !command
updateCustomCommand !updcc !command[@cooldown] lorem ipsum dolor e.g. !updcc !hw Hello World!

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.local-videos.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

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 InsanityMeetsHH

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

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