How riozee/rust-discord-bot works
Project type and purpose
• This is a Rust-based Discord bot: a standalone backend application that connects to Discord via the Gateway API, listens for messages, dispatches commands, and replies.
• It provides several chat commands (ping, help, get, post, eval, GPT, TeX rendering, Rust REPL, etc.) and likely interacts with external services (e.g., OpenAI for the GPT command).
File structure
• Top-level:
• Cargo.toml / Cargo.lock: Rust dependency manifest.
• README.md: development guide.
• .gitignore, .vscode: IDE/config files.
• src/ directory:
• main.rs: entry point, initializes bot, loads .env, connects to Discord.
• commands.rs: central dispatcher mapping command names to handlers.
• commands/ folder: one file per command implementation:
– ping.rs, help.rs, get.rs, post.rs, eval.rs, gpt.rs, tex.rs, rust_repl_cmd.rs
• No separate “frontend” – it’s purely a backend service.
• External config: .env file to hold DISCORD_TOKEN and possibly API keys.
README for additional insights
• Emphasizes local development steps, token security, and testing via a personal test bot.
• Implicitly uses the serenity or twilight crate (Discord SDK), plus HTTP clients for external commands.