Project

telegem

0.0
The project is in a healthy, maintained state
Telegem is a modern Telegram Bot Framework for Ruby inspired by Telegraf.js. Built with async-first design using async-http, featuring scenes, middleware, and a clean DSL. Perfect for building scalable Telegram bots.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
2026
 Dependencies

Development

~> 3.12
~> 1.50

Runtime

~> 0.92.1
~> 2.35
~> 0.10.0
~> 2.14.1
 Project Readme

Telegem Documentation

Welcome to the comprehensive documentation for Telegem, a modern Ruby framework for building Telegram bots.

CodeQl Gem Version Join Telegram Group

Table of Contents

Getting Started

Core Components

  • Bot - Main bot class and configuration
  • Context - Update context and response methods
  • Handlers - Command, hears, and event handlers
  • Middleware - Request processing pipeline
  • Scenes - Multi-step conversation flows
  • Sessions - Data persistence between updates

API & Types

  • API - Telegram API client usage
  • Types - Type-safe API response handling
  • Keyboards - Inline and reply keyboard DSL

Advanced Features

Examples & Guides

Quick Start

  1. Install Telegem:
gem install telegem
  1. Create your first bot:
require 'telegem'

bot = Telegem.new(token: 'YOUR_BOT_TOKEN')

bot.command('start') do |ctx|
  ctx.reply('Hello, World!')
end

bot.start_polling
  1. Explore features:
    • Add handlers for different message types
    • Use sessions for data persistence
    • Implement scenes for complex conversations
    • Deploy with webhooks for production

Key Features

  • Async I/O: Built on the Async gem for high performance
  • Type Safety: Automatic type conversion for API responses
  • Session Management: Built-in session stores (Memory, Redis)
  • Plugin System: Extensible with custom plugins
  • Scene System: Complex conversation flows
  • Middleware: Request processing pipeline
  • Error Handling: Comprehensive error recovery
  • Testing: Full test suite with mocking support

Architecture Overview

┌─────────────────┐    ┌─────────────────┐    ┌─────────────────┐
│   Telegram API  │◄──►│   API Client    │◄──►│     Handlers     │
└─────────────────┘    └─────────────────┘    └─────────────────┘
                                ▲
                                │
                    ┌─────────────────┐
                    │   Middleware    │
                    └─────────────────┘
                                ▲
                                │
                    ┌─────────────────┐
                    │    Sessions     │
                    └─────────────────┘

Support

Contributing

We welcome contributions! See our contributing guide for details.

License

Telegem is released under the MIT License. See the main README for details.


Happy bot building with Telegem! 🤖

gem 'telegem'

Basic Usage

require 'telegem'

bot = Telegem.new('YOUR_BOT_TOKEN')

bot.command('start') do |ctx|
  ctx.reply("Hello, #{ctx.from.first_name}!")
end

bot.start_polling

Requirements

License

MIT License - see LICENSE file for details.

Contributing

See Contributing Guide for development setup and contribution guidelines. /home/slick/telegem/docs/README.md