Adapters API
shirdal.core.botapi_adapter.BotAPIAdapter
Zero-dependency, Keep-Alive Telegram Bot API adapter for shirdal.
call(method, payload=None, **kwargs)
async
Public Bot API method call (accepts a payload dict or keyword arguments).
send_ephemeral_message(chat_id, text, *, receiver_user_id=None, callback_query_id=None, replace_callback_query_message=False, reply_to=None, parse_mode='html', reply_markup=None)
async
Send a Bot API 10.2+ ephemeral message visible only to a specific user.
edit_ephemeral_message(chat_id, ephemeral_message_id, text, *, parse_mode='html', reply_markup=None)
async
Edit an existing Bot API 10.2+ ephemeral message.
delete_ephemeral_message(chat_id, ephemeral_message_id)
async
Delete a Bot API 10.2+ ephemeral message.
send_message_draft(chat_id, draft_id, text, *, message_thread_id=None, parse_mode='html', can_stop=False, keep_on_stop=False)
async
Stream a partial message draft (Bot API 9.3 / 9.5 / 10.3).
set_chat_member_tag(chat_id, user_id, tag=None)
async
Set or clear a member's text tag in a group (Bot API 9.5+).
create_forum_topic(chat_id, name, *, icon_color=None, icon_custom_emoji_id=None)
async
Create a forum topic in a supergroup or private chat (Bot API 9.4+).
edit_forum_topic(chat_id, message_thread_id, *, name=None, icon_custom_emoji_id=None)
async
Edit a forum topic's name or icon.
close_forum_topic(chat_id, message_thread_id)
async
Close an open forum topic.
reopen_forum_topic(chat_id, message_thread_id)
async
Reopen a closed forum topic.
delete_forum_topic(chat_id, message_thread_id)
async
Delete a forum topic along with all its messages.
unpin_all_forum_topic_messages(chat_id, message_thread_id)
async
Clear the list of pinned messages in a forum topic.
get_forum_topic_icon_stickers()
async
Get custom emoji stickers usable as forum topic icons.
get_available_gifts()
async
Return the list of gifts that can be sent by the bot.
send_gift(gift_id, *, user_id=None, chat_id=None, pay_for_upgrade=None, text=None, text_parse_mode=None, text_entities=None)
async
Send a gift to a user or channel chat.
gift_premium_subscription(user_id, month_count, star_count, *, text=None, text_parse_mode=None, text_entities=None)
async
Gift a Telegram Premium subscription to a user using Stars.
post_story(business_connection_id, content, active_period, *, caption=None, parse_mode=None, caption_entities=None, areas=None, post_to_chat_page=None, protect_content=None)
async
Post a story on behalf of a managed business account.
edit_story(business_connection_id, story_id, content, *, caption=None, parse_mode=None, caption_entities=None, areas=None)
async
Edit a previously posted business story.
delete_story(business_connection_id, story_id)
async
Delete a story previously posted by the bot on behalf of a business account.
get_business_connection(business_connection_id)
async
Get information about the connection of the bot with a business account.
read_business_message(business_connection_id, chat_id, message_id)
async
Mark an incoming business message as read.
delete_business_messages(business_connection_id, message_ids)
async
Delete messages on behalf of a business account.
set_business_account_name(business_connection_id, first_name, *, last_name=None)
async
Change the first and last name of a managed business account.
set_business_account_username(business_connection_id, *, username=None)
async
Change the username of a managed business account.
set_business_account_bio(business_connection_id, *, bio=None)
async
Change the bio of a managed business account.
set_business_account_gift_settings(business_connection_id, show_gift_button, accepted_gift_types)
async
Change privacy settings pertaining to incoming gifts in a business account.
get_business_account_star_balance(business_connection_id)
async
Return the amount of Telegram Stars owned by a managed business account.
get_business_account_gifts(business_connection_id, *, exclude_unsaved=None, exclude_saved=None, exclude_unlimited=None, exclude_limited=None, exclude_unique=None, sort_by_price=None, offset=None, limit=None)
async
Return the gifts received and owned by a managed business account.
convert_gift_to_stars(business_connection_id, owned_gift_id)
async
Convert a regular gift owned by a business account to Telegram Stars.
upgrade_gift(business_connection_id, owned_gift_id, *, keep_original_details=None, star_count=None)
async
Upgrade a regular gift owned by a business account to a unique gift.
transfer_gift(business_connection_id, owned_gift_id, new_owner_chat_id, *, star_count=None)
async
Transfer an owned unique gift to another user.
set_my_settings(*, can_join_groups=None, can_read_all_group_messages=None, is_inline=None, inline_query_placeholder=None, needs_inline_query_location=None, has_topics_enabled=None, has_topic_sidebar=None, callback_query_mode=None, **extra)
async
Update bot settings via Bot API 10.5+ setMySettings.
set_webhook(url, *, secret_token=None, drop_pending_updates=False, allowed_updates=None, max_connections=None)
async
Configure Telegram Bot API webhook endpoint.
delete_webhook(*, drop_pending_updates=False)
async
Remove the configured Telegram Bot API webhook.
send_rich_message(chat_id, rich_msg=None, *, html=None, markdown=None, blocks=None, media=None, is_rtl=None, skip_entity_detection=None, reply_to=None, reply_markup=None, ephemeral_message_parameters=None, message_thread_id=None, disable_notification=False, protect_content=False)
async
Send a structured Bot API 10.1+ Rich Message.
send_rich_message_draft(chat_id, draft_id, rich_msg=None, *, html=None, markdown=None, blocks=None, is_rtl=None, message_thread_id=None, can_stop=False, keep_on_stop=False)
async
Stream a partial Bot API 10.1+ Rich Message draft.
create_webhook_server(*, host='0.0.0.0', port=8080, path='/webhook', secret_token=None)
Create a zero-dependency asyncio WebhookServer bound to this adapter.
shirdal.core.native_mtproto_adapter.NativeMTProtoAdapter
Native MTProto 2.0 TransportAdapter implementing shirdal's TransportAdapter protocol.
First run with session_path asks for phone number, login code and 2FA password
(or uses bot_token) and stores the session; later runs log in silently.
call(method, **params)
async
Invoke a Telegram API method by name, e.g. call("help.getConfig").
ping()
async
Measure raw MTProto edge round-trip latency in milliseconds.
start()
async
Log in (bot token or phone/code/2FA). Safe to call when already authorized.
sync_updates_state()
async
Recover missed updates via updates.getDifference.
If a sync is already running, remember that another was requested and run once more when it finishes: a message that hit a pts gap during the running sync is not in its result, and would otherwise be dropped until some later update re-triggers a sync.
get_history_ids(chat_id, *, limit=100, offset_id=0, only_outgoing=False)
async
Fetch real message IDs from chat history (newest to oldest).
get_reply_sender_id(chat_id, reply_to_msg_id)
async
Resolve the sender user/chat ID of a replied-to message.
shirdal.core.hybrid_adapter.HybridAdapter
Routes standard bot traffic over primary (e.g. BotAPIAdapter) and large media (>50 MiB) over mtproto.
shirdal.core.mock_adapter.MockAdapter
In-memory adapter for local testing without Telegram credentials.