Skip to content

notelyoo/PapeBot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

2 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿ“Œ PapeBot - Twitch & Discord Moderation Bot ๐ŸŽฎ

Welcome to PapeBot, a smart moderation bot designed exclusively for PapeSan's Twitch channel, with seamless integration between Discord and Twitch.
It empowers moderators to manage Twitch chat directly from Discord, trigger automated announcements, and much more!


๐ŸŒŸ Features

  • ๐Ÿค– Discord & Twitch Integration โ€” Manage Twitch from Discord
  • โŒ Ban, Unban, Timeout, Warn โ€” Full moderation control from Discord
  • โš ๏ธ Warning System โ€” Send alerts to users with /warn
  • ๐Ÿ“‹ User Lookup โ€” View Twitch user info, status, moderation buttons
  • ๐ŸŽฌ Create Clips โ€” Capture live moments instantly
  • ๐Ÿ”” Auto Announcements โ€” Periodic Twitch messages only when live
  • ๐ŸŒ Timezone Setup โ€” Set local time for Twitch chat
  • ๐Ÿ“ข Live Detection โ€” Sends Discord + Twitch alert when stream starts
  • ๐Ÿ”ƒ Dynamic Config โ€” /config to change announcement channel
  • ๐Ÿ“ฃ Message Command โ€” Send a Twitch chat message via official API
  • ๐Ÿ›ก๏ธ Blacklist System โ€” Auto timeout users every 14 days with /blacklist
  • ๐Ÿ—‘๏ธ Unblacklist Command โ€” Remove users from auto timeout with /unblacklist
  • ๐Ÿ“œ List Blacklisted Users โ€” See all users currently blacklisted with /liste-blacklist
  • ๐Ÿ’ฌ Twitch Custom Commands โ€” Manage custom chat commands directly from Discord

๐Ÿ› ๏ธ Technologies Used

  • Node.js โ€” JavaScript backend runtime
  • Discord.js โ€” Discord bot framework
  • Twitch Helix API โ€” Official Twitch integration
  • dotenv โ€” Manage secrets and tokens securely
  • axios โ€” Handle all API requests
  • tmi.js โ€” Twitch IRC client (legacy support)
  • moment-timezone โ€” Handle timezones and formatting

๐Ÿ“‚ Project Structure

PapeBot/
โ”œโ”€โ”€ commands/         # Slash commands (ban, timeout, warn, user, blacklist, etc.)
โ”‚   โ”œโ”€โ”€ announce.js
โ”‚   โ”œโ”€โ”€ ban.js
โ”‚   โ”œโ”€โ”€ blacklist.js
โ”‚   โ”œโ”€โ”€ clips.js
โ”‚   โ”œโ”€โ”€ config.js
โ”‚   โ”œโ”€โ”€ heure.js
โ”‚   โ”œโ”€โ”€ listAnnouncements.js
โ”‚   โ”œโ”€โ”€ listBlacklist.js
โ”‚   โ”œโ”€โ”€ listCommands.js
โ”‚   โ”œโ”€โ”€ message.js
โ”‚   โ”œโ”€โ”€ timeout.js
โ”‚   โ”œโ”€โ”€ unban.js
โ”‚   โ”œโ”€โ”€ unblacklist.js
โ”‚   โ”œโ”€โ”€ untimeout.js
โ”‚   โ”œโ”€โ”€ user.js
โ”‚   โ”œโ”€โ”€ warn.js
โ”œโ”€โ”€ utils/            # Utility functions (Twitch & Discord integration)
โ”‚   โ”œโ”€โ”€ banUser.js
โ”‚   โ”œโ”€โ”€ blacklistManager.js
โ”‚   โ”œโ”€โ”€ createClip.js
โ”‚   โ”œโ”€โ”€ createEmbed.js
โ”‚   โ”œโ”€โ”€ customCommands.js
โ”‚   โ”œโ”€โ”€ getModeratorId.js
โ”‚   โ”œโ”€โ”€ getTimezone.js
โ”‚   โ”œโ”€โ”€ getUserIdFromTwitch.js
โ”‚   โ”œโ”€โ”€ liveWatcher.js
โ”‚   โ”œโ”€โ”€ sendChatMessage.js
โ”‚   โ”œโ”€โ”€ sendMessage.js
โ”‚   โ”œโ”€โ”€ setTimezone.js
โ”‚   โ”œโ”€โ”€ timeoutUser.js
โ”‚   โ”œโ”€โ”€ unbanUser.js
โ”‚   โ”œโ”€โ”€ warnUser.js
โ”œโ”€โ”€ blacklistedUsers.json # Stores blacklisted users and their timers
โ”œโ”€โ”€ customCommands.json # Stores customs commands
โ”œโ”€โ”€ userTimezones.json     # Stores timezone info
โ”œโ”€โ”€ config.json            # Discord announce channel config
โ”œโ”€โ”€ .env                   # Environment variables (not committed)
โ”œโ”€โ”€ bot.js                 # Main bot entry point

๐Ÿš€ Installation & Setup

1๏ธโƒฃ Clone the Project

git clone https://github.com/notelyoo/PapeBot.git
cd PapeBot

2๏ธโƒฃ Install Dependencies

cd backend
npm install

3๏ธโƒฃ Configure .env

DISCORD_TOKEN=your-discord-bot-token
TWITCH_CHANNEL=your-twitch-channel
TWITCH_BOT_USERNAME=your-twitch-bot-account
TWITCH_OAUTH_TOKEN=your-user-access-token-with-scopes
TWITCH_CLIENT_ID=your-client-id
TWITCH_CLIENT_SECRET=your-client-secret

Required Twitch scopes: user:write:chat, clips:edit, moderator:manage:banned_users You can use Twitch Token Generator to create your token and choose your scopes.

4๏ธโƒฃ Run the Bot

node bot.js

๐ŸŽฎ Command List

๐Ÿ”จ Moderation

Command Description
/ban <user> <reason> Ban a Twitch user permanently
/unban <user> Unban a previously banned user
/timeout <user> <duration> <reason> Timeout user in seconds
/untimeout <user> Lift an active timeout
/warn <user> <message> Send a warning message
/blacklist <pseudo> Blacklist a user (auto timeout every 14 days)
/unblacklist <pseudo> Remove a user from the blacklist

๐Ÿ’ก Utilities

Command Description
/user <pseudo> Show Twitch user profile & mod actions
/clips Create a Twitch clip (live only)
/heure <timezone> Set the bot's timezone (e.g., Europe/Paris)
/config channel Set the Discord channel for live announcements
/liste View and stop periodic announcements
/liste-commandes View all custom Twitch chat commands
/liste-blacklist View blacklisted users
/annonce <message> <interval> Schedule a periodic message if live
/message <message> Send one message in Twitch chat via API

๐Ÿ“ข Live Detection

  • PapeBot checks Twitch live status every 30 seconds.
  • When the live starts:
    • โœ‰๏ธ Embed sent in the configured Discord channel.
    • ๐Ÿ’ฌ Message in Twitch chat: "Le live vient de commencer. Bienvenue ร  tous !"
  • When the live ends:
    • ๐Ÿ”ด Message: "Le live est terminรฉ. Merci d'avoir รฉtรฉ prรฉsents ๐Ÿ’œ"
    • All periodic announcements are paused automatically.

๐Ÿ”” Contributing

Contributions are welcome!
Feel free to fork the project, create a branch, and submit a pull request.
All contributions must comply with the AGPLv3 license.


๐Ÿ“„ License

Licensed under GNU AGPLv3 โ€” free to use, modify, and share publicly under the same license.
See LICENSE for full details.


๐Ÿ’ฌ Contact


๐ŸŽฎ Thanks for checking out PapeBot! ๐Ÿ’œ

About

๐Ÿ›ก๏ธ Moderation bot for Twitch & Discord โ€“ built for PapeSanโ€™s channel. Enables efficient chat management and cross-platform control for moderators.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors