Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

PyTgBot

Minimal Telegram Bot framework using requests.

Features

  • Simple and minimalistic API for building Telegram bots
  • Middleware support for message preprocessing
  • Custom message handlers with filters
  • Easy message sending and editing (text, photo, audio, video)

Installation

pip install .

Usage

from pytgbot import Bot, filters, middleware
from pytgbot.handler import on_message

# Example middleware
@middleware.use
def lowercase_text(message):
    if 'text' in message:
        message['text'] = message['text'].lower()
    return message

# Example handler for /start command
@on_message(filters.cmd("start"))
def start_handler(msg):
    msg.send("Welcome to the bot!")

# Example handler for a specific message
@on_message(filters.msg("hello"))
def hello_handler(msg):
    msg.send("Hi there!")

if __name__ == "__main__":
    bot = Bot("YOUR_BOT_TOKEN")
    bot.run()

Project Structure

License

MIT

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages