Titanio is a fun, modular Telegram bot written in Rust using the teloxide
framework. It's a great starting point for building bots with async Rust!
- Built with Rust,
teloxide
framework andtokio
for async concurrency - Modular command handling (
/help
,/weather
,/joke
,/ping
, etc.) - Environment-based config with
.env
- Clean, beginner-friendly project structure
- Uses external APIs (like JokeAPI and wttr.in) with no login required
To run the bot, make sure you have:
- 🦀 Rust (use
rustup
to install) - 🔐 A Telegram bot token (from @BotFather)
- 📄 A
.env
file with your token and optional API keys
- Clone the repo
git clone https://github.com/LoboGuardian/titanio-rust-telegram-bot.git
cd titanio-rust-telegram-bot
- Set Up Environment Variables
In the root folder, create a .env file with the environment variables required for the bot to function. You can use the provided env.example as a starting point:
cp env.example .env
# Required: Telegram bot token
TELOXIDE_TOKEN=your_telegram_bot_token_here
# Required: Currency conversion API token (https://exchangerate.host/)
EXCHANGERATE_TOKEN=your_exchangerate_api_key_here
# Optional: Control Rust logging level
RUST_LOG=info
- Run the bot
cargo run
Your bot is now alive and rolling dice in reply to messages it receives! 🎉
.
├── Cargo.toml // Project metadata and dependencies
├── .env // Environment variables (not committed)
├── README.md // You're reading it!
├── LICENSE // MIT License
└── src
├── commands/ // Modular command handlers
│ ├── fun/ // Fun and random commands
│ │ ├── joke.rs
│ │ └── roll.rs
│ │
│ ├── info/ // Informational and meta commands
│ │ ├── about.rs
│ │ ├── help.rs
│ │ ├── id.rs
│ │ └── time.rs
│ │
│ ├── system/ // System-related and bot control commands
│ │ ├── start.rs
│ │ └── ping.rs
│ │
│ ├── utils/ // Utility and API-integrated commands
│ │ ├── echo.rs
│ │ ├── currency.rs
│ │ └── weather.rs
│ │
│ ├── fallback/ // Fallback handlers for invalid/unknown input
│ │ ├── unknown_command.rs
│ └── mod.rs // Command enum and dispatch logic
│
└─── main.rs // Bot entry point and command dispatcher setup
Command | Description |
---|---|
/joke |
Tell a random joke |
/roll |
Roll a Telegram dice |
Command | Description |
---|---|
/about |
Info about the bot |
/help |
Show available commands |
/id |
Show your user ID and chat ID |
/time |
Show the current server time |
Command | Description |
---|---|
/start |
Greet the user |
/ping |
Check if the bot is alive |
Command | Description |
---|---|
/echo <text> |
Echo back your message |
/weather <city> |
Show weather info using wttr.in |
/currency <query> |
Convert amount from one currency to another |
Want more? You can easily add /quote, /cat, /translate, or even /todo with just a bit of async Rust!
teloxide
– Telegram Bot frameworktokio
– async runtimedotenv
– load .env configreqwest
– HTTP client for APIsserde
– JSON deserializationlog
,pretty_env_logger
– logging
We appreciate all the contributions to the Titanio bot!


Want to contribute? Check out our CONTRIBUTING.md for guidelines on how to get involved!
Why not?
Rust is fast, safe, and makes writing concurrent code a breeze. This bot project is a great way to learn about:
- Async/await
- External APIs
- Modular design in Rust
- Telegram bot development
New to Rust? Check out the Rust Book. It’s free and amazing!
This project is licensed under the MIT License.
Built with 🦀 and ❤️ for Telegram.