Skip to content

cfunkz/Watch2Gether-Discord-Bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

42 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Watch2Gether Bot Logo

Watch2Gether Discord Bot

GitHub stars GitHub forks GitHub issues

📚 Table of Contents

Features

  • Create new temporary rooms via Watch2Gether.
  • Link existing Watch2Gether rooms.
  • Validate and verify Watch2Gether URLs using regular expressions (regex).
  • Manage multiple rooms per user with limits.
  • Add videos to playlist.
  • Instant play a video.
  • Download & Dump local database and reload bot cogs via admin panel.
  • Uses aiohttp for asynchronous HTTP requests.
  • Uses aiosqlite for asynchronous database operations, enabling concurrency.
  • Employs Discord modals, select menus, and options for interactive user input and command handling.
  • Simple Admin Panel for database management and reloading cogs.
  • Custom logger

Setup

API KEY: Get your Watch2Gether API key from your account page:
W2G Profile Page

Discord Bot Token: Create a bot on the Discord Developer Portal:
DISCORD API

git clone https://github.com/cfunkz/Watch2Gether-Discord-Bot.git
cd Watch2Gether-Discord-Bot

Create and activate a Python virtual environment

python3 -m venv .venv
source .venv/bin/activate  # Linux/macOS
.\.venv\Scripts\activate   # Windows PowerShell

Install dependencies

pip install -r requirements.txt

Configure your environment

Edit config.py with:

W2G_API_KEY = "WATCH2GETHER KEY"
BOT_TOKEN = "DISCORD TOKEN"
DB_FILE = "user_rooms.db" # Database file path
GUILD_ID = 1234567890000000001  # Your server ID
ROLE_ID = 1234567898098766554   # Admin Role ID that should have access
MAX_LOG_SIZE = 33554432  # Maximum LOG SIZE in bytes (32 MB)
ROTATE_LOGS = 5  # HOW MANY LOGS TO ROTATE
LOG_FILE = 'discord.log'
DEFAULT_AVATAR = "https://i.ibb.co/TMnHDzL2/watchparty.png"  # Default avatar URL
MAX_USER_ROOM = 10

Run the bot

python main.py

⚠️ Note: Ensure you have the required permissions for the bot in your Discord server. Don't forget to set admin role and guild in the .env or config.py.

Usage

Admin Panel

Run /admin to open a private panel with buttons for:

  • Downloading or dumping the database
  • Checking ping
  • Reloading cogs

Manage Rooms

Use the /watch command to manage Watch2Gether rooms. The bot can create a temporary room, link existing rooms, share, delete rooms, add to playlist and instant play a video from discord.

Images

Main

Create Add
Room List Share Invite
Delete Rooms Admin Panel
Logger

About the Developer

Built with ❤️ by cfunkz — learning the wizardry of Debian, Python & SQL.
If this project helped you, consider ⭐ starring the repo or buying me a coffee!

ko-fi