Discord bot for:
- Meme sound playback from local files and Mongo-backed lookup
- YouTube audio playback with queue controls
- Time-announcement audio clips
- Slash commands:
/sd meme:<name>: Play a meme sound/yt url:<youtube-url>: Queue YouTube audio/time: Play the current time clip/eclipse: Play the eclipse clip
- Queue controls (buttons on
/ytembed):StopSkipResume
- Node.js
- discord.js v14
- @discordjs/voice
- MongoDB driver
- yt-dlp-wrap for resilient YouTube audio URL extraction
- Node.js 18+ (Node 20+ recommended)
- A Discord application + bot token
- A target Discord server (guild) where commands should be registered
- Optional: MongoDB Atlas cluster for meme metadata
- Install dependencies:
npm install- Configure bot values in
config.json:
{
"token": "YOUR_DISCORD_BOT_TOKEN",
"guildId": "YOUR_GUILD_ID",
"clientId": "YOUR_APPLICATION_CLIENT_ID",
"mongoUser": "YOUR_DB_USER",
"mongoPassword": "YOUR_DB_PASSWORD",
"mongoCluster": "YOUR_CLUSTER_HOST_AND_DB",
"roleId": 1234567890
}Example mongoCluster format:
cluster0.example.mongodb.net/test
- Register slash commands to your guild:
node deploy-commands.js- Optional: import local meme sound records into MongoDB:
node deploy-sounds.jsnpm startExpected startup logs:
Ready!Loaded Memes from DB(if Mongo is reachable)
If Mongo is unavailable, the bot continues running and logs a warning.
- Lint:
npm run lint- Start directly:
node .npm outdated
npm update
npm run lint- Upgrade package(s):
npm install <package>@latest- Validate:
npm run lint
npm start- The bot uses
yt-dlp-wrapand downloadsyt-dlp.exetobin/yt-dlp.exeautomatically if missing. - To refresh the yt-dlp binary manually:
- Stop the bot
- Delete
bin/yt-dlp.exe - Start bot again with
npm start
- Most commonly caused by multiple bot instances running at once.
- Ensure only one
node .process is active for this project.
- If the cluster is paused/inactive, startup may log Mongo warnings.
- The bot is designed to keep running, but Mongo-backed lookups may be limited.
- Verify the URL is public and playable in browser.
- Retry with a plain watch URL format:
https://www.youtube.com/watch?v=<VIDEO_ID>
- If extraction behavior changes over time, restart bot to refresh yt-dlp binary logic.
Run once in PowerShell:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -ForceThen reopen terminal.
index.js: bot bootstrap, interaction routingcommands/: slash command handlersshared/player.js: voice playback and queue engineshared/db.js: MongoDB helper layerdeploy-commands.js: guild command registrationdeploy-sounds.js: import local sound map into DBsounds/: local audio clips
- Do not commit live tokens/passwords.
- If credentials were exposed, rotate them immediately:
- Discord bot token
- MongoDB user/password