codelinered / twitch-chatbot
Twitch Chatbot made with Vue Skeleton
Installs: 0
Dependents: 0
Suggesters: 0
Security: 0
Stars: 3
Watchers: 2
Forks: 0
Open Issues: 0
Language:JavaScript
Type:project
Requires
- php: ^7.4
- vrana/adminer: 4.6.2
This package is auto-updated.
Last update: 2023-05-13 15:43:19 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 Third Party Code
- Install Guides
chatbot.js
- Project Commands
- Ports
chatbot.json
gulpfile.json
- Chatbot Commands
- Web UI Features
import-videos-folder.js
migration.js
- Localization
- Links
- Audio Files
- Known Issues
Included
- jQuery 3
- Bootstrap 4
- Font Awesome 5
- LazyLoad 17
- CSS User Agent 2
- Moment 2
- Datatables 1
- Sqlite3 5
- Vue 2
- Vue Router 3
- Vue i18n 8
- Vue Datetime Picker 2
- Vue SFC 1
Install Production Build (Recommended)
Required
Open console on your OS and navigate to your project folder. Download zip if you don't have git on your OS.
+++++ ZIP VERSION +++++
$ (unix) wget -O tcb-prod.zip https://github.com/CodelineRed/twitch-chatbot/archive/production.zip
$ (unix) unzip tcb-prod.zip
$ (win10) curl -L -o tcb-prod.zip https://github.com/CodelineRed/twitch-chatbot/archive/production.zip
$ (win10) tar -xf tcb-prod.zip
$ cd twitch-chatbot-production
$ npm i --only=prod
$ -- Add username, tmiToken and channels to src/app/chatbot.json ---
$ node migration.js
$ node chatbot.js
+++++ GIT VERSION +++++
$ git clone https://github.com/CodelineRed/twitch-chatbot.git
$ cd twitch-chatbot
$ git checkout production
$ (optional on unix) rm -rf .git
$ (optional on win10) rmdir .git /s
$ npm i --only=prod
$ -- Add username, tmiToken and channels to src/app/chatbot.json ---
$ node migration.js
$ node chatbot.js
+++++ COMPOSER VERSION +++++ $ php composer create-project codelinered/twitch-chatbot twitch-chatbot "dev-production" $ cd twitch-chatbot $ 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
Open 2 consoles on your OS and navigate both to your project folder. Download zip if you don't have git on your OS.
+++++ ZIP VERSION +++++
$ (unix) wget -O tcb-mstr.zip https://github.com/CodelineRed/twitch-chatbot/archive/master.zip
$ (unix) unzip tcb-mstr.zip
$ (win10) curl -L -o tcb-mstr.zip https://github.com/CodelineRed/twitch-chatbot/archive/master.zip
$ (win10) tar -xf tcb-mstr.zip
$ cd twitch-chatbot-master
$ npm i
$ gulp build
$ -- Add username, tmiToken and channels to src/app/chatbot.json ---
$ node migration.js
$ node chatbot.js
$ (in 2nd console) gulp
+++++ GIT VERSION +++++
$ git clone https://github.com/CodelineRed/twitch-chatbot.git
$ cd twitch-chatbot
$ git checkout master
$ (optional on unix) rm -rf .git
$ (optional on win10) 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
+++++ COMPOSER VERSION +++++
$ php composer create-project codelinered/twitch-chatbot
$ cd twitch-chatbot
$ 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, Composer 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 $ docker-compose run composer install --no-dev $ 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 $ npm i $ gulp build $ node migration.js $ node chatbot.js
Open localhost:3050 for Web UI or localhost:3050/adminer.php for Database GUI.
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] |
(Deprecated) !addbot BotName | |
(Deprecated) !rmbot BotName | |
(Deprecated) !addcc !command[@cooldown] lorem ipsum e.g. !addcc !hw@10 hello world | |
(Deprecated) !rmcc !command | |
(Deprecated) !tglcc !command | |
(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. (Seedocker-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
andclientIdToken
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
inchatbot.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
- Web UI:
i18n-locales.js
- Web UI:
langswitch.vue
- Node:
locales.js
Links
- Twitch Messaging Interface
- Twitch TMI Token
- Twitch API Token
- Twitch API Reference
- YouTube API Token
- BetterTTV API
- FrankerFaceZ API
- Twitch Clip API
- Twitch Clip Embed
- Twitch Video Embed
- ESLint Js Rules
- ESLint Vue Rules
- ESLint Import Rules
- Sass Lint Rules
- Vue SFC
- Path to RegExp
- Moment Parsing (Date Format)
- SCSS Confetti
Audio Files
- Airy by CodelineRed
- Ambi EP by CodelineRed
- Big Clap
- Brassy by CodelineRed
- C-Space by CodelineRed
- Cheering and Clapping
- Ensemble by CodelineRed
- Fan Fare 1
- Fan Fare 2
- Fan Fare 3
- Freedom by Dracon
- Hope by Dracon
- Memory Palace by Dracon
- Peace by Dracon
- Valley by Dracon
- Voice of Doubt by Dracon
- Winner Deep Voice
- Winner Female Voice
- Winner Robot Voice
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
- The API sends a wrong