Hey Ruby community! I'm excited to share Telegem v3.0.0 - a complete rewrite of the Telegram bot framework with one goal: true async performance without the thread headaches.
🤔 Why Another Telegram Gem?
If you've used telegram-bot-ruby, you know the struggle:
· Thread pools to manage
· Blocking I/O slowing things down
· Complex deployment setups
Telegem takes a different approach: pure async architecture using Ruby's native async gem and HTTPX.
✨ What's New in v3.0.0?
🔥 Pure Async Architecture
# Before: Thread pools + blocking HTTP
# After: Async tasks + non-blocking HTTPX
bot.start_polling # Uses Async tasks, not threads
🎯 Simplified API
# No more thread configuration!
bot = Telegem.new(token) # That's it.
# Gone: max_threads:, worker_count:, thread_pool options
📚 Best-in-Class Documentation
· Scene system for multi-step conversations (like wizards/forms)
· Complete guides with real examples (pizza bot, crypto tracker, support bot)
· API reference that actually explains return values
🎮 Killer Feature: Scenes
# Build multi-step flows easily
bot.scene :order_pizza do
step :choose_size do |ctx|
ctx.reply("Small, Medium, or Large?")
end
step :choose_toppings do |ctx|
ctx.session[:size] = ctx.message.text
ctx.reply("What toppings?")
end
step :confirm do |ctx|
ctx.session[:toppings] = ctx.message.text
ctx.reply("Order placed! 🍕")
ctx.leave_scene
end
end
⚡ Performance Benefits
Telegem v3.0.0
- Async fibers
- ~5MB per 1000 users
- Fiber-unlimited
- Only stalls current task
🚀 Getting Started
Install
gem install telegem
# or in Gemfile
gem 'telegem', '~> 3.0'
Your First Bot (60 seconds)
require 'telegem'
bot = Telegem.new(ENV['BOT_TOKEN'])
bot.command('start') do |ctx|
ctx.reply "Hello #{ctx.from.first_name}! 👋"
end
bot.command('pizza') do |ctx|
ctx.enter_scene(:order_pizza)
end
bot.start_polling # Development
# or bot.webhook.run # Production
🎯 Real-World Examples Included
The gem ships with complete example bots:
· examples/pizza_bot.rb - Full e-commerce with scenes
· examples/crypto_bot.rb - Real-time prices with async APIs
· examples/support_bot.rb - Ticket system with sessions
🔧 Migration from v2.x
# Before (v2.x):
bot = Telegem.new(token, max_threads: 10, worker_count: 5)
# After (v3.0):
bot = Telegem.new(token) # Thread options removed
# All ctx methods return HTTPX::Response (call .json to parse)
🌐 Webhook-First Design
# One-line production deploy
bot.webhook.run # Auto-detects: Render, Railway, Heroku, Fly.io
# Or manually:
server = bot.webhook(port: 3000, secret_token: 'your-secret')
server.run
server.set_webhook
📈 Why I Built This
After maintaining bots with telegram-bot-ruby, I kept hitting thread deadlocks and complex scaling issues. Telegem is my answer: Modern Ruby deserves a modern bot framework.
🎁 What's Next?
· Plugin ecosystem (payments, analytics, etc.)
· Built-in admin dashboard
· More session stores (PostgreSQL, Redis clusters)
· Your feature requests!
🔗 Links & Resources
· GitLab Repo: https://gitlab.com/ruby-telegem/telegem
· Documentation: Complete guides in the repo
· Examples: 5+ real bots you can run today
🤝 Call for Contributors
Telegem is stable but young. Looking for:
· Testers - Try it with your bot ideas
· Documentation - Help make the guides even better
· Feature ideas - What do you need in a bot framework?
💬 Let's Chat!
Have questions? Found a bug? Want to contribute?
· Open an issue on GitLab
· Star the repo if you're excited about async Ruby
· Try it and share your bot creations!
Telegem v3.0.0 - Because building Telegram bots in Ruby should be fun, fast, and frustration-free. Give it a spin and let me know what you think! 🚀
P.S. Special thanks to the async and httpx gem maintainers - your work makes this possible!
What's your take on async Ruby? Have you tried building Telegram bots before? Share your experiences in the comments! 👇
Top comments (0)