Skip to content

Repository files navigation

Quick context

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.

Big-picture architecture (what to know)

  • Single-process Node.js bot using discord.js v14 and @discordjs/voice.
  • Bot lifecycle: reads .env (via dotenv) → logs in with DISCORD_BOT_TOKEN → registers a single slash command /richgettinrowdy → handles interactions in RowdyBot.js.
  • Main side-effects: joins a voice channel, plays RichIsAThief.opus, bans/unbans members, and creates/send guild invites.

Files to reference

  • RowdyBot.js — primary source of truth (command registration, validation, audio playback, ban/reinvite flow).
  • package.json — shows runtime scripts: npm start (node) and npm run dev (nodemon).
  • RichIsAThief.opus — bundled audio asset referenced by RowdyBot.js.

Important environment variables

  • 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 in validateExecution).

When editing code, preserve reads from process.env and guidance around early exit when token is missing.

Project-specific conventions & patterns

  • Single-file bot: most logic is concentrated in RowdyBot.js.
  • Active-bans guard: activeBans Set 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.

Developer workflows & commands

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.

Safety & permission considerations

The bot requires the BanMembers permission to operate. validateExecution() checks bot permissions.

Examples of patterns to follow when changing behavior

  • When adding commands: register them in the client.once('ready') block using SlashCommandBuilder
  • When adding asynchronous sequences that affect state (ban/unban, invites, voice), follow the existing try/catch/finally patterns and always remove IDs from activeBans on all exit paths.
  • When sending user-facing messages, use the existing Embed builders (createErrorEmbed, createInfoEmbed, createSuccessEmbed) to keep responses consistent.

About

A Discord bot to keep the peace

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages