Skip to main content
This is a pre-production deployment of Warehouse. Changes made here affect the production instance of PyPI (
Help us improve Python packaging - Donate today!

Telegram Bot framework

Project Description

# telegraph_commander
Telegram simple bot framework

## 1. First, extend BaseBot class, and provide router and configuration:
from telegraph_commander.logger import get_console_handler
from import BaseBot
from telegraph_commander.command import CommandRouter, BotCommand
from telegraph_commander.config import BotConfig

class YourBotConfig(BotConfig):
TELEGRAM_API_KEY = '<api_key>'

class YourBot(BaseBot):
router_class = CommandRouter
config_class = YourBotConfig

bot = YourBot()


## 2. Bind commands to router :
class MenuCommand(BotCommand):
async def run(self):
await self.telegram_api.send_message(self.chat_id, 'Select action', variants=[['/mul']])

class MulCommand(BotCommand):
dict(name='operand_1', title='first argument'),
dict(name='operand_2', title='second argument')
async def run_handle(self):
result = float(self.operand_1) * float(self.operand_2)
await self.telegram_api.send_message(self.chat_id, 'result: {}'.format(result))

## 3. Add console logger handler(optional), and run your bot:

Release History

This version
History Node


History Node


History Node


Download Files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, Size & Hash SHA256 Hash Help File Type Python Version Upload Date
(12.2 kB) Copy SHA256 Hash SHA256
Source None Sep 14, 2016

Supported By

Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Google Google Cloud Servers DreamHost DreamHost Log Hosting