This repository contains a small Discord bot (single-file implementation) that temporarily bans a target user, plays a sound in a voice channel, then unbans and sends an invite DM. The primary implementation is in RowdyBot.js and runtime scripts are defined in package.json. Note that the DMs don't work unless the bot and the player share a server in common which will be tricky because the bot just banned them from the current server.
- Single-process Node.js bot using
discord.jsv14 and@discordjs/voice. - Bot lifecycle: reads
.env(viadotenv) → logs in withDISCORD_BOT_TOKEN→ registers a single slash command/richgettinrowdy→ handles interactions inRowdyBot.js. - Main side-effects: joins a voice channel, plays
RichIsAThief.opus, bans/unbans members, and creates/send guild invites.
RowdyBot.js— primary source of truth (command registration, validation, audio playback, ban/reinvite flow).package.json— shows runtime scripts:npm start(node) andnpm run dev(nodemon).RichIsAThief.opus— bundled audio asset referenced byRowdyBot.js.
DISCORD_BOT_TOKEN— required; the bot exits if missing.TARGET_VOICE_CHANNEL_ID— the voice channel ID the bot should join.TARGET_GUILD_ID— the guild ID containing the voice channel and the target member.ADMIN_ROLE_IDS— comma-separated role IDs (used to protect admin users invalidateExecution).
When editing code, preserve reads from process.env and guidance around early exit when token is missing.
- Single-file bot: most logic is concentrated in
RowdyBot.js. - Active-bans guard:
activeBansSet is used to dedupe concurrent executions for the same user. Respect and reuse this pattern when adding queuing or rate limiting behavior. - Timeouts: the code relies on a fixed
BAN_DURATION. Currently 15 seconds.
Run locally with a .env file in repo root and start the bot:
- Development (auto-reload):
npm run dev - Production run:
npm start
Ensure ffmpeg is available — the project includes ffmpeg-static in dependencies; no global ffmpeg install should be required.
The bot requires the BanMembers permission to operate. validateExecution() checks bot permissions.
- When adding commands: register them in the
client.once('ready')block usingSlashCommandBuilder - When adding asynchronous sequences that affect state (ban/unban, invites, voice), follow the existing try/catch/finally patterns and always remove IDs from
activeBanson all exit paths. - When sending user-facing messages, use the existing Embed builders (
createErrorEmbed,createInfoEmbed,createSuccessEmbed) to keep responses consistent.