This package contains a YouTube Live Chat bot with:
- Shared points / coins
- First-time user welcome bonus: 10,000 coins
- Trivia
- Blackjack
- Roulette
- Slots
- Craps
- Dungeon RPG
- Admin-only !kill command
This is a sanitized template. Private/personal information has been removed and replaced with placeholders like: *** YOUR INFO GOES HERE ***
DO NOT SHARE THESE FILES AFTER YOU ADD YOUR REAL OAUTH INFO OR token.json.
bot.js Main bot file casino.js Blackjack, roulette, slots, and craps rpg-game.js Dungeon RPG game trivia.json Sample trivia questions package.json Node dependency list SETUP_AND_COMMANDS.txt This setup and command guide .gitignore Prevents token.json, scores.json, and node_modules from being shared
The old !kill often failed because it only checked one exact display name. This version checks:
- OWNER_NAMES in bot.js
- OWNER_CHANNEL_IDS in bot.js, if provided
- YouTube owner / broadcaster badge when available
When !kill works, it now:
- Stops the bot from accepting commands
- Stops trivia
- Clears blackjack games
- Resets the craps table
- Resets the dungeon game
- Saves scores.json
- Stops the live chat reader when possible
- Exits the Node process
-
Install Node.js Download and install Node.js from nodejs.org. During installation, make sure Add to PATH is enabled.
-
Put this folder somewhere easy, for example: C:\Users\YOUR WINDOWS USER\Desktop\Bot Games for Youtube Live Chat
-
Open Command Prompt or Windows Terminal in the bot folder.
Example: cd "C:\Users\YOUR WINDOWS USER\Desktop\Bot Games for Youtube Live Chat"
-
Install dependencies: npm install
If you do not use package.json, you can also run: npm install googleapis youtube-chat
-
Create Google OAuth credentials.
Go to Google Cloud Console. Create or choose a project. Enable the YouTube Data API v3. Configure the OAuth consent screen. Create an OAuth client.
Recommended redirect URI for this bot: http://localhost
-
Open bot.js and replace these placeholders:
const CLIENT_ID = '*** YOUR GOOGLE OAUTH CLIENT ID GOES HERE '; const CLIENT_SECRET = ' YOUR GOOGLE OAUTH CLIENT SECRET GOES HERE ***';
Put your real Google OAuth client ID and client secret there.
-
Set your admin name in bot.js:
const OWNER_NAMES = [ '*** YOUR EXACT YOUTUBE CHAT NAME GOES HERE ***', ];
Replace the placeholder with your exact YouTube chat display name. Example only: const OWNER_NAMES = ['YourChannelName'];
You can add multiple names: const OWNER_NAMES = ['YourChannelName', '@YourHandle'];
-
Optional: set your owner channel ID.
const OWNER_CHANNEL_IDS = [ '*** OPTIONAL: YOUR OWNER CHANNEL ID GOES HERE ***', ];
This is optional, but it makes admin detection stronger.
-
Choose how the bot finds your live stream.
AUTO-DETECT MODE: Leave CHANNEL_ID as the placeholder or blank. The bot will use the OAuth account and find the current live stream from that channel.
MANUAL CHANNEL MODE: Replace CHANNEL_ID with a YouTube channel ID if you want the bot to watch a specific channel.
Example only: const CHANNEL_ID = 'UCXXXXXXXXXXXXXXXXXXXXXX';
You do NOT need to paste the live video URL every time. The bot searches the channel for the active live stream automatically.
-
Edit trivia.json.
This format works:
[ { "q": "Question here?", "a": "Answer here" }, { "q": "Another question?", "a": "Another answer" } ]
This format also works:
[ { "question": "Question here?", "answer": "Answer here" } ]
- Run the bot:
node bot.js
- First-time OAuth login.
The bot will print a Google login URL. Open it in your browser. Approve access. You may land on a localhost page that does not load. That is okay. Copy ONLY the value after code= and before &scope=. Paste that code into Command Prompt while it says: Paste the code here:
The bot will create token.json.
- Future runs:
After token.json exists, just run: node bot.js
Never share these after setup:
- token.json
- scores.json if you care about user points
- bot.js if it contains your real CLIENT_ID and CLIENT_SECRET
If you accidentally shared OAuth credentials, regenerate the client secret in Google Cloud Console.
Any first-time user who triggers the bot with a ! command gets: 10,000 coins
This is controlled in bot.js: const STARTING_COINS = 10000;
Existing users in scores.json do not get the bonus again.
!kill Admin-only. Stops the bot, ends active games, saves scores, and exits Node.
!reloadtrivia Admin-only. Reloads trivia.json without restarting the bot.
!points Shows your coin balance.
!score Same as !points.
!leaderboard Shows the top 5 coin holders.
!top Same as !leaderboard.
!give Gives coins to another user. Example: !give SomeUser 500
!trivia Starts one trivia question. First exact correct answer wins coins. Answer does not need a ! prefix.
Example: Bot: TRIVIA: What planet is known as the Red Planet? Viewer: Mars
Trivia reward: +10 coins
Trivia timeout: 25 seconds
!blackjack Starts a blackjack hand. Example: !blackjack 100
!bj Short version of !blackjack. Example: !bj 100
!hit Draw another card.
!h Short version of !hit.
!stand End your turn and let the dealer play.
!st Short version of !stand.
Blackjack notes:
- Minimum bet is controlled in casino.js.
- Natural 21 pays instantly.
- Win pays 2x.
- Tie returns the bet.
!roulette !r
Examples: !roulette red 100 !roulette black 100 !roulette green 100 !roulette 0 100 !roulette 00 100 !roulette 17 100 !roulette even 100 !roulette odd 100
Short examples: !r red 100 !r 17 100
Bet types: red black green 0 00 1 through 36 even odd
!spin 100 !spin 200 !spin 300
Short commands: !s100 !s200 !s300
Slot notes:
- Only 100, 200, and 300 coin bets are accepted.
- Three matching symbols pay the best.
- Two matching symbols can pay smaller prizes.
Full commands: !craps join !craps leave !craps table !craps roll !craps pass !craps dont !craps come !craps place !craps hard !craps any7 !craps anycrap
Short join: !cj
Once you are seated at the craps table, these shortcut commands also work: !roll !leave !table !pass !dont !come !place !hard !any7 !anycrap
Craps notes:
- Max players: 5
- Shooter rotates after seven-out
- Place numbers: 4, 5, 6, 8, 9, 10
- Hardway numbers: 4, 6, 8, 10
Setup: !startdungeon Starts a new dungeon lobby.
!join Joins the dungeon lobby as default class.
!join Joins and chooses a class. Example: !join mage
!class Changes class during the lobby only.
Classes: warrior mage rogue cleric ranger paladin
Info: !helpdungeon Shows dungeon help.
!status Shows your HP, potions, and cooldowns.
!party Shows party status.
!roll Rolls a d20 in the RPG context.
!roll d6 Rolls a specific die.
Combat: !attack Basic attack.
!defend Defend this round.
!sp Use your class special.
!take Drink a health potion.
!loot Claim room weapon or loot if available.
!flee Vote to flee.
!stay Vote to stay.
Class specials: !bash Warrior special.
!fireball Mage special.
!hide Rogue stealth setup.
!backstab Rogue special after hiding.
!heal Cleric special.
!multishot Ranger special.
!smite Paladin special.
Install dependencies: npm install
Start the bot: node bot.js
Stop the bot from chat: !kill
Stop the bot from Windows manually: CTRL + C