Loading repository data…
Loading repository data…
raigon-pawa / repository
Codex is a modular Discord bot designed for university groups, gaming friends, and casual communities who want productivity + fun in one place. Built for private friend servers but powerful enough for public release, Codex combines study tools, AI assistance, gaming utilities, and social features into a smooth, modern experience.
A transparent discovery signal based on current public GitHub metadata.
This score does not audit code, security, maintainers, documentation quality, or suitability. Verify the repository and its current documentation before adoption.
Codex is a modular Discord bot designed for university groups, gaming friends, and casual communities who want productivity + fun in one place. Built for private friend servers but powerful enough for public release, Codex combines study tools, AI assistance, gaming utilities, and social features into a smooth, modern experience.
Built with discord.py 2.7 on Python 3.14.
A complete, runnable foundation that already exercises the main Discord interaction surfaces, so you can confirm everything works before piling on features:
| Cog | What it demonstrates |
|---|---|
general | Hybrid commands — /ping and !ping (serverinfo, userinfo, help) |
events | Welcome / goodbye messages to a configurable channel (members intent) |
moderation | Permission-gated commands (/kick, /ban, /timeout, /clear) |
components | Buttons, select menus, modals, and user/message context menus |
social | XP & levels with SQLite persistence (/rank, /leaderboard) |
ai | Claude /ask, /chat (cached multi-turn memory), /summarize |
study | /pomodoro, /remindme (SQLite-backed), /flashcards deck |
roles | Button self-assign roles (persistent) + auto level-up roles |
gaming | Native /poll, /roll dice, /trivia, /lfg board |
automod | Native AutoMod rule management + an audit mod-log (/automod, /logging) |
music | Voice playback via yt-dlp + FFmpeg (/music play, queue, volume, …) |
premium | App Subscriptions — SKU/entitlement-gated perks (/premium) |
owner | Owner-only prefix commands — !sync (global / guild / clear) |
settings | Per-server config — /prefix and /welcome (channel + on/off) |
31 slash commands + 2 context menus, all verified to load. Common info commands
(ping, help, serverinfo, userinfo, rank, leaderboard) are hybrid —
they work as both /cmd and !cmd.
# 1. Create & activate a virtual environment
python3 -m venv .venv
source .venv/bin/activate # Windows: .venv\Scripts\activate
# 2. Install dependencies
pip install -r requirements.txt
# 3. Configure secrets
cp .env.example .env # then edit .env (see Part 1 below)
# 4. Run
python bot.py
Python 3.14 note: discord.py needs the
audioopmodule for voice, which was removed from the standard library in Python 3.13. Theaudioop-ltspackage restores it and is pulled in automatically as a dependency — no action needed.
Music note: the
musiccog streams audio through FFmpeg, which must be installed and on yourPATH(sudo apt install ffmpeg,brew install ffmpeg, …). The Docker image installs it for you.PyNaClandyt-dlpcome fromrequirements.txt.
Everything below happens at https://discord.com/developers/applications.
Codex, accept the terms, Create.APPLICATION_ID in your .env.DISCORD_TOKEN in .env.
Treat it like a password; never commit it. (.env is already git-ignored.)Still on the Bot tab, scroll to Privileged Gateway Intents and enable all three:
These mirror the three privileged intents Codex requests in config.py. If they're
off here, the bot crashes on login with PrivilegedIntentsRequired.
Once your bot is in 100+ servers you must apply for verification to keep privileged intents. For a private friends' server you're fine.
Open the Installation tab. Discord now supports two install targets:
bot +
applications.commands and pick default permissions.Pick the Install Link type (Discord Provided Link is easiest), and the generated URL is what you share to add Codex.
If you'd rather build the invite link by hand, open OAuth2 → URL Generator:
bot and applications.commands.View Channels, Send Messages, Send Messages in Threads, Embed Links,
Attach Files, Read Message History, Add Reactions, Use External Emojis,
Manage Messages (for /clear), Manage Roles (reaction roles / level roles),
Kick Members, Ban Members, Moderate Members (timeouts),
Manage Events, Connect + Speak (voice/music later).Prefer not to grant
Administrator— it's a security risk and hides which permissions a feature actually needs.
Codex syncs its slash commands globally on startup, so every server it's in gets them. Global syncs can take up to ~1 hour to appear the first time.
While developing, that wait is annoying, so there's an owner-only prefix command:
!sync guild — sync to the current server instantly (great for testing).!sync — force a global re-sync (e.g. after adding a command).!sync clear — remove the current server's guild-specific commands (clears duplicates
if you previously used a per-guild sync).You can also mention the bot: @Codex sync. (DEV_GUILD_ID in .env is legacy and no
longer used — global sync is automatic.)
.env:
DISCORD_TOKEN=your-bot-token
APPLICATION_ID=your-app-id
DEV_GUILD_ID=your-test-server-id # optional but recommended while developing
python bot.pySynced N commands… and Online as Codex#1234. Type / in your server
and Codex's commands appear.You asked to use as much of what Discord offers as possible. Here's the full surface and where each piece lives (✅ built, 🔜 on the roadmap):
| Discord feature | Used by / planned module | Status |
|---|---|---|
| Slash commands | every cog | ✅ |
| User & message context menus | components (Avatar, Report Message) | ✅ |
| Embeds | everywhere | ✅ |
| Buttons / Select menus / Modals | components | ✅ |
| Persistent views (survive restart) | components (PanelView) | ✅ |
| Privileged intents (members/content) | events, social | ✅ |
| Gateway events (join/leave/message) | events, social | ✅ |
| Permissions & default-perms gating | moderation | ✅ |
| Timeouts (communication disabled) | moderation | ✅ |
| Persistence (SQLite) | core/database, social | ✅ |
| AI assistance (Claude) | ai — /ask, /chat, /summarize | ✅ |
| Prompt caching (cost saving) | ai — /chat caches conversation history | ✅ |
| Study tools | study — pomodoro, reminders, flashcards | ✅ |
| Reminders / scheduled tasks | study (via discord.ext.tasks loop) | ✅ |
| Polls (native Discord polls) | gaming — /poll | ✅ |
| Gaming utilities | gaming — dice, trivia, LFG | ✅ |
| Reaction roles / self-assign roles | roles — button panel + auto level roles | ✅ |
| AutoMod rule management | automod — /automod keyword/preset/mention rules | ✅ |
| Audit log streaming | automod — /logging → mod-log channel | ✅ |
| Voice / music | music — /music play (yt-dlp + FFmpeg) | ✅ |
| App Subscriptions / Entitlements | premium — SKU/entitlement-gated perks | ✅ |
| Scheduled Events (study sessions) | events extension | 🔜 |
| Webhooks (announcements/feeds) | webhooks | 🔜 |
| Application Emojis | branding / reactions | 🔜 |
| Linked Roles (role-connection meta) | linkedroles (e.g. "verified student") | 🔜 |
| Soundboard / Stage channels | community/events features | 🔜 |
The premium cog gates perks on a Discord subscription SKU — Discord handles
the payment, so there's no billing code on our side. To turn it on:
/premium skus (owner-only; the app owner is detected automatically —
OWNER_IDS in .env is only for adding extra owners) to read the SKU's ID.PREMIUM_SKU_ID (.env) and restart. /premium status and the
native upgrade button now reflect real subscriptions.Gate any command elsewhere with the same one-line entitlement check the cog uses.
codex-bot/
├── bot.py # entry point: CodexBot, extension loading, command sync
├── config.py # env loading, intents, brand colour
├── requirements.txt
├── .env.example # copy to .env
├── core/
│ └── database.py # async SQLite helper + schema
└── cogs/ # one module per feature area
├── general.py
├── events.py
├── moderation.py
├── components.py
├── social.py
├── ai.py # Claude /ask, /chat (cached), /summarize
├── study.py # pomodoro, reminders, flashcards
├── roles.py # self-assign + level roles
├── gaming.py # polls, dice, trivia, LFG
├── automod.py # AutoMod rule