robogram package

Submodules

robogram.api_telegram_bot module

Telegram Bot API.

class robogram.api_telegram_bot.ChatActions(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

FIND_LOCATION = 'find_location'
RECORD_AUDIO = 'record_audio'
RECORD_VIDEO = 'record_video'
TYPING = 'typing'
UPLOAD_AUDIO = 'upload_audio'
UPLOAD_DOCUMENT = 'upload_document'
UPLOAD_PHOTO = 'upload_photo'
UPLOAD_VIDEO = 'upload_video'
class robogram.api_telegram_bot.TeleBot(token)[source]

Bases: object

forward_message(chat_id, from_chat_id, message_id, disable_notification=None)[source]
get_chat_ids_from_updates(offset=None, limit=None, timeout=None)[source]

Get a mapping of Chat ID to Chat Type/Title, based on /getUpdates response.

Example Response: {

12345: ‘[PRIVATE] User321’, -97531: ‘[CHANNEL] My Channel’,

}

get_file(file_id, filename=None, directory=None)[source]
get_me()[source]
get_updates(offset=None, limit=None, timeout=None)[source]
get_user_profile_photos(user_id, offset=None, limit=None)[source]
send_audio(chat_id, audio_path, duration=None, performer=None, title=None, disable_notification=None, reply_to_message_id=None, reply_markup=None)[source]
send_chat_action(chat_id, action: ChatActions)[source]
send_document(chat_id, document_path, caption=None, disable_notification=None, reply_to_message_id=None, reply_markup=None)[source]
send_file(method, chat_id, filepath, **optional)[source]
send_location(chat_id, latitude, longitude, disable_notification=None, reply_to_message_id=None, reply_markup=None)[source]
send_message(chat_id, text, parse_mode='Markdown', disable_web_page_preview=True, disable_notification=False, reply_to_message_id=None, reply_markup=None)[source]
send_photo(chat_id, photo_path, caption=None, disable_notification=None, reply_to_message_id=None, reply_markup=None)[source]
send_sticker(chat_id, sticker_path, disable_notification=None, reply_to_message_id=None, reply_markup=None)[source]
send_video(chat_id, video_path, duration=None, caption=None, disable_notification=None, reply_to_message_id=None, reply_markup=None)[source]
send_voice(chat_id, voice_path, duration=None, disable_notification=None, reply_to_message_id=None, reply_markup=None)[source]
set_webhook(hook=None)[source]
robogram.api_telegram_bot.handle_requests_errors(func)[source]

robogram.errors module

exception robogram.errors.RobogramException(msg: str, e: RequestException = None)[source]

Bases: Exception

Module contents

Robogram

Minimal API Wrapper, utilizing Telegram Bot API to send messages (to a user, channel, or group).

Sample Usage:
>>> from pprint import pprint
>>> from robogram import TeleBot
>>> bot = TeleBot('TOKEN')
>>> me = bot.get_me()
>>> pprint(me)
>>> chat_id = -123456789
>>> bot.send_message(chat_id, 'Hello World!')

For full documentation and more advanced usage, please see <https://robogram.readthedocs.io>.

copyright:
  1. 2024 by Ritvik Nag.

:license:MIT, see LICENSE for more details.

class robogram.ChatActions(value, names=<not given>, *values, module=None, qualname=None, type=None, start=1, boundary=None)[source]

Bases: Enum

FIND_LOCATION = 'find_location'
RECORD_AUDIO = 'record_audio'
RECORD_VIDEO = 'record_video'
TYPING = 'typing'
UPLOAD_AUDIO = 'upload_audio'
UPLOAD_DOCUMENT = 'upload_document'
UPLOAD_PHOTO = 'upload_photo'
UPLOAD_VIDEO = 'upload_video'
class robogram.TeleBot(token)[source]

Bases: object

forward_message(chat_id, from_chat_id, message_id, disable_notification=None)[source]
get_chat_ids_from_updates(offset=None, limit=None, timeout=None)[source]

Get a mapping of Chat ID to Chat Type/Title, based on /getUpdates response.

Example Response: {

12345: ‘[PRIVATE] User321’, -97531: ‘[CHANNEL] My Channel’,

}

get_file(file_id, filename=None, directory=None)[source]
get_me()[source]
get_updates(offset=None, limit=None, timeout=None)[source]
get_user_profile_photos(user_id, offset=None, limit=None)[source]
send_audio(chat_id, audio_path, duration=None, performer=None, title=None, disable_notification=None, reply_to_message_id=None, reply_markup=None)[source]
send_chat_action(chat_id, action: ChatActions)[source]
send_document(chat_id, document_path, caption=None, disable_notification=None, reply_to_message_id=None, reply_markup=None)[source]
send_file(method, chat_id, filepath, **optional)[source]
send_location(chat_id, latitude, longitude, disable_notification=None, reply_to_message_id=None, reply_markup=None)[source]
send_message(chat_id, text, parse_mode='Markdown', disable_web_page_preview=True, disable_notification=False, reply_to_message_id=None, reply_markup=None)[source]
send_photo(chat_id, photo_path, caption=None, disable_notification=None, reply_to_message_id=None, reply_markup=None)[source]
send_sticker(chat_id, sticker_path, disable_notification=None, reply_to_message_id=None, reply_markup=None)[source]
send_video(chat_id, video_path, duration=None, caption=None, disable_notification=None, reply_to_message_id=None, reply_markup=None)[source]
send_voice(chat_id, voice_path, duration=None, disable_notification=None, reply_to_message_id=None, reply_markup=None)[source]
set_webhook(hook=None)[source]