Skip to main content

Library for sending messages and files using a Telegram bot.

Project description

Installation

pip install telegram-bot-reporter

Usage Sync

from telegram_bot_reporter import Bot

bot = Bot(bot_token=TELEBOT_TOKEN, chat_id=CHAT_ID)

# Send message
bot.send_message('Hello, world')

# Send file
temp_file = Path('test.txt')
with open(temp_file, mode='w', encoding='utf-8') as f:
    f.write('Test message')
bot.send_document(temp_file)

# Send long message (more than 4000 symbols)
bot.send_message('Very long message over 4000 symbols', split_message=True)

Usage Async

from telegram_bot_reporter import AsyncBot

bot = AsyncBot(bot_token=TELEBOT_TOKEN, chat_id=CHAT_ID)

await bot.send_message('Hello, world')

# Send file
temp_file = Path('test.txt')
with open(temp_file, mode='w', encoding='utf-8') as f:
    f.write('Test message')
await bot.send_document(temp_file)

# Send long message (more than 4000 symbols)
await bot.send_message('Very long message over 4000 symbols', split_message=True)

Project details


Download files

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

Source Distribution

telegram_bot_reporter-0.1.2.tar.gz (6.2 kB view hashes)

Uploaded Source

Built Distribution

telegram_bot_reporter-0.1.2-py3-none-any.whl (4.4 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page