DEV Community

Cover image for Building a Secure & Elegant Anonymous Confession Bot in Discord.py (with Cogs & Rich Logging)
wxwreak
wxwreak

Posted on

Building a Secure & Elegant Anonymous Confession Bot in Discord.py (with Cogs & Rich Logging)

🤫 AnonBot

A sleek, modern anonymous confession Discord bot built with python, discord.py, and rich terminal styling.


✨ Features

  • Modular Architecture: Utilizes discord.ext.commands.Cog via the cogs/ directory.
  • Strict Channel Restriction: The /send command only works in a designated source channel (SEND_CHANNEL_ID) and forwards submissions safely to a target channel (POST_CHANNEL_ID).
  • Built-in Rate Limiting: Enforces cooldowns per user (@app_commands.checks.cooldown) to prevent spamming.
  • Rich Terminal Logging: Startup sequences and diagnostics styled nicely with the rich library.


📂 Project Structure

my_discord_bot/
│
├── cogs/
│   └── anonym.py
├── .env
├── bot.py
└── requirements.txt
Enter fullscreen mode Exit fullscreen mode

⚙️ Configuration (.env)

Create a .env file in the root directory and configure your keys:

DISCORD_TOKEN=your_bot_token_here
GUILD_ID=your_development_guild_id_here
SEND_CHANNEL_ID=id_of_channel_where_users_type
POST_CHANNEL_ID=id_of_channel_where_confessions_appear
Enter fullscreen mode Exit fullscreen mode

🚀 Installation & Running

  1. Clone the repository:
   git clone https://github.com/wxwreak/anon-discord-bot
   cd anon-discord-bot
Enter fullscreen mode Exit fullscreen mode
  1. Install dependencies:
   pip install discord.py python-dotenv rich
Enter fullscreen mode Exit fullscreen mode
  1. Run the bot:
   python bot.py
Enter fullscreen mode Exit fullscreen mode

Top comments (0)