Skip to content

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!

License

Notifications You must be signed in to change notification settings

LoboGuardian/titanio-rust-telegram-bot

Repository files navigation

Titanio-Rust-Telegram-Bot

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!

🚀 Features

  • Built with Rust, teloxide framework and tokio 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

📦 Requirements

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

🛠️ Setup

  1. Clone the repo
git clone https://github.com/LoboGuardian/titanio-rust-telegram-bot.git
cd titanio-rust-telegram-bot
  1. 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
  1. Run the bot
cargo run

Your bot is now alive and rolling dice in reply to messages it receives! 🎉

📁 Project Structure

.
├── 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

💬 Supported Commands

🎉 Fun

Command Description
/joke Tell a random joke
/roll Roll a Telegram dice

ℹ️ Info

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

⚙️ System

Command Description
/start Greet the user
/ping Check if the bot is alive

🛠️ Utilities

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!

🛠 Tech & Crates Used

❤️ Contributors

We appreciate all the contributions to the Titanio bot!

LoboGuardian aodihis

Want to contribute? Check out our CONTRIBUTING.md for guidelines on how to get involved!

🃏 A joke

Why not?

alt text

🦀 Why Rust?

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!

📄 License

This project is licensed under the MIT License.

Built with 🦀 and ❤️ for Telegram.

About

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!

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published