rustycord 🦀
⚠️ DEVELOPMENT NOTICE: rustycord is currently in heavy development and is NOT ready for production use. APIs may change frequently, features are incomplete, and breaking changes occur regularly. Do not use for production bots yet. Wait for the stable 1.0 release.
A modern, fast, and easy-to-use Discord bot library for Rust, designed with a focus on simplicity and developer experience.
🚧 Current Development Status
- ✅ Basic bot functionality - Working
- ✅ Message handling system - Functional
- ✅ Prefix command system - Implemented
- ✅ HTTP client - Basic functionality
- ✅ Gateway connection - Stable
- ⚠️ Advanced features - Under development
- ❌ Slash commands - Not implemented
- ❌ Voice support - Not available
- ❌ Comprehensive testing - Needed
- ❌ Stable API - Still changing
Use only for experimentation and learning. Not suitable for production bots.
Features ✨
- Simple API: Easy-to-use message handling system
- Fast: Built with async/await and tokio for high performance
- Flexible: Modular architecture with customizable handlers
- Well-typed: Full type safety with serde serialization
- Event-driven: Comprehensive event system for Discord Gateway
- Shard support: Built-in sharding for large bots
- Modern: Uses latest Rust features and best practices
- Rich Logging: Comprehensive logging system with multiple levels and colored output
- Developer-Friendly: Extensive debug information and easy troubleshooting
Quick Start 🚀
Basic Bot
use ;
async
Logging Configuration
rustycord provides comprehensive logging to help you understand what your bot is doing:
use setup_logger;
async
Example log output:
2024-07-17 15:30:45 :: [INFO] :: 🚀 Starting bot...
2024-07-17 15:30:45 :: [DEBUG] :: 🌐 Making request to Discord API
2024-07-17 15:30:45 :: [INFO] :: ✅ Successfully authenticated as: MyBot#1234
2024-07-17 15:30:45 :: [INFO] :: 🔌 Connected to The Discord
2024-07-17 15:30:45 :: [INFO] :: 🚀 Bot is ready!
2024-07-17 15:30:50 :: [INFO] :: 📨 Message received: Hello! from Username
2024-07-17 15:30:50 :: [DEBUG] :: 🔄 Processing MESSAGE_CREATE with 2 handler(s)
Message Handler
use ;
use async_trait;
;
async
Built-in Handlers
use ;
// Add built-in handlers
handlers.add_handler.await; // Responds to "ping" with "Pong!"
handlers.add_handler.await; // Echoes back all messages
Send Messages with Embeds
use Embed;
let embed = new
.title
.description
.color;
client.send_embed_message.await?;
API Overview 📚
Core Components
- Bot: Main entry point for creating and running bots
- Client: HTTP client for Discord API interactions
- MessageHandler: Trait for handling message events
- EventDispatcher: Routes gateway events to handlers
- Embed: Rich embed message builder
Message Handling
Sending Messages
// Send text message
client.send_text_message.await?;
// Send message with embed
let embed = new.title.description;
client.send_embed_message.await?;
// Send message with both text and embeds
client.send_message.await?;
Examples 📝
Check out the examples directory for more comprehensive examples:
- Basic Bot - Simple bot setup
- Message Handler - Advanced message handling
Installation 📦
Add this to your Cargo.toml:
[]
= { = "https://github.com/iamdhakrey/rustycord" }
= { = "1.0", = ["full"] }
= "0.1"
Development Status 🚧
rustycord is currently in active development. See PROGRESS.md for detailed status.
Completed ✅
- Basic bot infrastructure
- Message handling system
- HTTP client for Discord API
- WebSocket gateway connection
- Event dispatching
- Embed support
In Progress 🔄
- Command framework
- Slash commands
- Interaction handling
- Enhanced error handling
Planned 📋
- Voice support
- Application commands
- Advanced caching
- Plugin system
Contributing 🤝
Contributions are welcome! Areas where help is needed:
- Feature implementation
- Documentation
- Testing
- Performance optimization
- Example projects
Development Commands
# Quick development commands
# Release commands (maintainers only)
License 📄
This project is licensed under the MIT License - see the LICENSE file for details.
Support 💬
- Create an issue for bugs or feature requests
- Join our Discord server (coming soon)
- Check the documentation (coming soon)
Acknowledgments 🙏
- Inspired by serenity-rs
- Built with tokio and serde
- Thanks to the Discord API team for excellent documentation
Made with ❤️ and 🦀 by the rustycord team