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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Close
Hashes for telegram_bot_reporter-0.1.5.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ea747821296ff899e055e7d1c35b5cc9e24e5ebe0f4daabced29e629bf296e8f |
|
MD5 | d58db828a9cf961c332cfec13b25b42c |
|
BLAKE2b-256 | c6d01db7b9327eb451a0c1978640f4dd5426e556dd732b019ff8e5470091a093 |
Close
Hashes for telegram_bot_reporter-0.1.5-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 70f243aa45d318db13c9bfd12b3dc3f6da0dfe199b0f8350fefddc01103d7820 |
|
MD5 | 89c08061bfe2da11d89c3fdd0b5ce315 |
|
BLAKE2b-256 | b04fa10836f56c992e6b3547c4fefb8504af1d2c18d86102be564ce4f550b02d |