### Install and Run Pyroblack Basic Example Source: https://eymarv.github.io/pyroblack-docs/main/intro/quickstart This Python script demonstrates how to initialize a pyroblack client using your Telegram API ID and Hash, and send a message to yourself. Ensure you have `pyrogram` installed (`pip3 install -U pyroblack`). ```python import asyncio from pyrogram import Client api_id = 12345 api_hash = "0123456789abcdef0123456789abcdef" async def main(): async with Client("my_account", api_id, api_hash) as app: await app.send_message("me", "Greetings from **pyroblack**!") asyncio.run(main()) ``` -------------------------------- ### Install Pyroblack with pip Source: https://eymarv.github.io/pyroblack-docs/main/intro/install Installs or upgrades Pyroblack to the latest stable version using pip. This is the recommended method for installation. ```shell $ pip3 install -U pyroblack ``` ```shell $ pip3 install -U pyroblack tgcrypto ``` -------------------------------- ### Verify Pyroblack Installation Source: https://eymarv.github.io/pyroblack-docs/main/intro/install Verifies the Pyroblack installation by importing the pyrogram library in a Python shell and checking its version. No errors indicate a successful installation. ```python >>> import pyrogram >>> pyrogram.__version__ 'x.y.z' ``` -------------------------------- ### Connect to Telegram Test Servers with pyrogram Source: https://eymarv.github.io/pyroblack-docs/main/topics/test-servers This code snippet demonstrates how to start a new session with pyroblack's test servers by setting `test_mode=True`. It then prints the user's information from the test environment. Ensure pyrogram is installed (`pip install pyrogram`). ```python from pyrogram import Client async with Client("my_account_test", test_mode=True) as app: print(await app.get_me()) ``` -------------------------------- ### Welcome Bot: Implementing a Welcome Bot with Pyroblack Source: https://eymarv.github.io/pyroblack-docs/main/start/examples/index Features a "Welcome Bot" example script. It's designed to be copied and run, with necessary modifications for session names and target chats. ```python # Example: welcome_bot # A Welcome Bot # This is a placeholder for the actual code snippet. # In a real scenario, this would contain Python code # for a welcome bot using Pyroblack. ``` -------------------------------- ### Start, Idle, and Stop Client with run() Source: https://eymarv.github.io/pyroblack-docs/main/api/methods/run This example demonstrates the basic usage of Client.run() to start, idle, and stop a Pyrogram client sequentially. It's a convenience method that calls start(), idle(), and stop() in order. ```python from pyrogram import Client app = Client("my_account") ... # Set handlers up app.run() ``` -------------------------------- ### Get Chat Members: Fetching All Chat Members with Pyroblack Source: https://eymarv.github.io/pyroblack-docs/main/start/examples/index Demonstrates how to get all members of a chat using Pyroblack. The script is runnable after credential setup, with potential adjustments to session names and target chats. ```python # Example: get_chat_members # Get all the members of a chat # This is a placeholder for the actual code snippet. # In a real scenario, this would contain Python code # to get chat members with Pyroblack. ``` -------------------------------- ### Handle Specific Commands ('start', 'help') - Python Source: https://eymarv.github.io/pyroblack-docs/main/topics/use-filters This example uses the `filters.command()` filter to trigger a handler only when specific commands like '/start' or '/help' are received. ```python @app.on_message(filters.command(["start", "help"])) async def my_handler(client, message): print(message) ``` -------------------------------- ### Get Dialogs: Retrieving All Dialog Chats with Pyroblack Source: https://eymarv.github.io/pyroblack-docs/main/start/examples/index This example script retrieves all of your dialog chats using Pyroblack. It's designed for immediate use after credential configuration, requiring session name and target chat modifications. ```python # Example: get_dialogs # Get all of your dialog chats # This is a placeholder for the actual code snippet. # In a real scenario, this would contain Python code # to get dialogs with Pyroblack. ``` -------------------------------- ### Raw Updates: Handling Raw Updates (Deprecated) with Pyroblack Source: https://eymarv.github.io/pyroblack-docs/main/start/examples/index This example covers handling raw updates, though it is noted as an older method and should be avoided in favor of newer approaches. Ensure credentials are set up correctly. ```python # Example: raw_updates # Handle raw updates (old, should be avoided) # This is a placeholder for the actual code snippet. # In a real scenario, this would contain Python code # for handling raw updates with Pyroblack, with a warning about its deprecated status. ``` -------------------------------- ### Client.start_bot() Source: https://eymarv.github.io/pyroblack-docs/main/api/methods/start_bot Starts a specified bot, with an optional parameter for deep linking. ```APIDOC ## Client.start_bot() ### Description Starts a specified bot. This action can be performed by both Users and Bots. ### Method POST ### Endpoint /start_bot ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **chat_id** (int | str) - Required - Unique identifier of the bot to start. Can be a username (str) or bot ID (int). - **param** (str) - Optional - Text of the deep linking parameter (up to 64 characters). Defaults to "". ### Request Example ```json { "chat_id": "pyrogrambot", "param": "ref123456" } ``` ### Response #### Success Response (200) - **message** (Message) - On success, the sent message is returned. #### Response Example ```json { "message": { "message_id": 123, "chat": { "id": 123456, "type": "private" }, "date": "2023-10-27T10:00:00Z", "text": "Bot started successfully." } } ``` ``` -------------------------------- ### Install uvloop for asyncio Source: https://eymarv.github.io/pyroblack-docs/main/topics/speedups Installs uvloop, a fast Cython-based replacement for Python's built-in asyncio event loop, offering significant performance improvements. ```shell pip3 install -U uvloop ``` -------------------------------- ### Start Bot with Pyrogram Source: https://eymarv.github.io/pyroblack-docs/main/api/methods/start_bot Starts a bot using the Pyrogram client. It requires a chat_id (username or ID) and can optionally accept a deep linking parameter. Returns a Message object on success. ```python await app.start_bot("pyrogrambot") # Start bot with param await app.start_bot("pyrogrambot", "ref123456") ``` -------------------------------- ### Hello World: Basic API Usage with Pyroblack Source: https://eymarv.github.io/pyroblack-docs/main/start/examples/index Demonstrates the fundamental usage of the Pyroblack API. This script is ready to run after setting up credentials, requiring only session name and target chat adjustments. ```python # Example: hello_world # Demonstration of basic API usage # This is a placeholder for the actual code snippet. # In a real scenario, this would contain Python code # demonstrating a "hello_world" functionality using Pyroblack. ``` -------------------------------- ### Use uvloop before Client instantiation Source: https://eymarv.github.io/pyroblack-docs/main/topics/speedups Shows the correct placement of `uvloop.install()` before creating a pyroblack Client instance and running the application. This ensures uvloop is active from the start. ```python import uvloop from pyrogram import Client uvloop.install() app = Client("my_account") @app.on_message() async def hello(client, message): print(await client.get_me()) app.run() ``` -------------------------------- ### Inline Queries: Handling Bot Inline Queries and Responding with Pyroblack Source: https://eymarv.github.io/pyroblack-docs/main/start/examples/index Demonstrates how to handle inline queries when acting as a bot and respond with results using Pyroblack. Ensure credentials are set and session names are configured. ```python # Example: inline_queries # Handle inline queries (as bot) and answer with results # This is a placeholder for the actual code snippet. # In a real scenario, this would contain Python code # for handling inline queries with Pyroblack. ``` -------------------------------- ### Configure Pyroblack Client with API Key Source: https://eymarv.github.io/pyroblack-docs/main/start/setup This snippet shows how to initialize the Pyroblack Client by passing your Telegram API ID and API Hash. These credentials are required to connect to the Telegram API. ```python from pyrogram import Client api_id = 12345 api_hash = "0123456789abcdef0123456789abcdef" app = Client("my_account", api_id=api_id, api_hash=api_hash) ``` -------------------------------- ### Get Active Stories from a Specific User/Channel Source: https://eymarv.github.io/pyroblack-docs/main/api/methods/get_peer_stories Fetches all active stories from a specified user or channel. This example demonstrates iterating through the returned generator to print each story. Requires an 'app' object with the 'get_peer_stories' method. ```python # Get all active story from spesific user/channel async for story in app.get_peer_stories(chat_id): print(story) ``` -------------------------------- ### Initialize and Use Pyroblack Client Source: https://eymarv.github.io/pyroblack-docs/main/api/client Demonstrates the basic initialization of the pyroblack Client and sending a message within a context manager. Requires the 'pyrogram' library. ```python from pyrogram import Client app = Client("my_account") with app: app.send_message("me", "Hi!") ``` -------------------------------- ### PeerSettings Source: https://eymarv.github.io/pyroblack-docs/main/telegram/types/peer-settings Details about the PeerSettings constructor and its parameters. ```APIDOC ## PeerSettings ### Description Constructor of `PeerSettings`. This class represents a Telegram API type. ### Method Constructor ### Endpoint N/A ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body - **report_spam** (bool) - Optional - N/A - **add_contact** (bool) - Optional - N/A - **block_contact** (bool) - Optional - N/A - **share_contact** (bool) - Optional - N/A - **need_contacts_exception** (bool) - Optional - N/A - **report_geo** (bool) - Optional - N/A - **autoarchived** (bool) - Optional - N/A - **invite_members** (bool) - Optional - N/A - **request_chat_broadcast** (bool) - Optional - N/A - **business_bot_paused** (bool) - Optional - N/A - **business_bot_can_reply** (bool) - Optional - N/A - **geo_distance** (int 32-bit) - Optional - N/A - **request_chat_title** (str) - Optional - N/A - **request_chat_date** (int 32-bit) - Optional - N/A - **business_bot_id** (int 64-bit) - Optional - N/A - **business_bot_manage_url** (str) - Optional - N/A - **charge_paid_message_stars** (int 64-bit) - Optional - N/A - **registration_month** (str) - Optional - N/A - **phone_country** (str) - Optional - N/A - **name_change_date** (int 32-bit) - Optional - N/A - **photo_change_date** (int 32-bit) - Optional - N/A ### Request Example ```json { "report_spam": true, "add_contact": false, "block_contact": true, "share_contact": false, "need_contacts_exception": true, "report_geo": false, "autoarchived": true, "invite_members": false, "request_chat_broadcast": true, "business_bot_paused": false, "business_bot_can_reply": true, "geo_distance": 100, "request_chat_title": "New Group", "request_chat_date": 1678886400, "business_bot_id": 1234567890, "business_bot_manage_url": "https://example.com/bot/manage", "charge_paid_message_stars": 10, "registration_month": "March", "phone_country": "US", "name_change_date": 1678886400, "photo_change_date": 1678886400 } ``` ### Response #### Success Response (200) PeerSettings object with the specified parameters. #### Response Example ```json { "report_spam": true, "add_contact": false, "block_contact": true, "share_contact": false, "need_contacts_exception": true, "report_geo": false, "autoarchived": true, "invite_members": false, "request_chat_broadcast": true, "business_bot_paused": false, "business_bot_can_reply": true, "geo_distance": 100, "request_chat_title": "New Group", "request_chat_date": 1678886400, "business_bot_id": 1234567890, "business_bot_manage_url": "https://example.com/bot/manage", "charge_paid_message_stars": 10, "registration_month": "March", "phone_country": "US", "name_change_date": 1678886400, "photo_change_date": 1678886400 } ``` ``` -------------------------------- ### Get Chat History: Retrieving Full Message History with Pyroblack Source: https://eymarv.github.io/pyroblack-docs/main/start/examples/index This script retrieves the complete message history of a specified chat using Pyroblack. Ensure your credentials are set up correctly and adjust session names as needed. ```python # Example: get_history # Get the full message history of a chat # This is a placeholder for the actual code snippet. # In a real scenario, this would contain Python code # to get chat history with Pyroblack. ``` -------------------------------- ### Get Folders using Client.get_folders() in Python Source: https://eymarv.github.io/pyroblack-docs/main/api/methods/get_folders Demonstrates how to retrieve folder information using the `Client.get_folders()` method. It shows examples for fetching a single folder, multiple folders, and all available folders. This method is asynchronous and requires an `app` object. ```python await app.get_folders(12345) # Get more than one folders (list of folders) await app.get_folders([12345, 12346]) # Get all folders await app.get_folders() ``` -------------------------------- ### Creating an Inline Keyboard Button to Launch a Web App Source: https://eymarv.github.io/pyroblack-docs/main/api/types/InlineKeyboardButton This snippet illustrates creating an inline keyboard button that launches a Web App. It requires the 'text' for the button label and a WebAppInfo object for the 'web_app' parameter, which describes the Web App to be launched. ```python from pyrogram.types import InlineKeyboardButton, WebAppInfo button = InlineKeyboardButton( text="Open Web App", web_app=WebAppInfo(url="https://webapp.example.com") ) ``` -------------------------------- ### Block script execution with Pyrogram idle() Source: https://eymarv.github.io/pyroblack-docs/main/api/methods/idle Demonstrates how to use pyrogram.idle() to keep multiple Pyrogram clients running in the background. This is essential for event-driven applications that rely on handlers to process incoming Telegram updates. The example shows starting multiple clients, idling, and then stopping them. ```python import asyncio from pyrogram import Client, idle async def main(): apps = [ Client("account1"), Client("account2"), Client("account3") ] ... # Set up handlers for app in apps: await app.start() await idle() for app in apps: await app.stop() asyncio.run(main()) ``` -------------------------------- ### Python: Answer Callback Query Examples Source: https://eymarv.github.io/pyroblack-docs/main/api/methods/answer_callback_query Demonstrates various ways to use the `answer_callback_query` method to respond to user interactions with inline keyboards. This includes simple acknowledgments, displaying text notifications, and showing alerts. ```python await app.answer_callback_query(query_id) ``` ```python await app.answer_callback_query(query_id, text=text) ``` ```python await app.answer_callback_query(query_id, text=text, show_alert=True) ``` -------------------------------- ### GET /api/chat/admin_invite_links Source: https://eymarv.github.io/pyroblack-docs/main/api/methods/get_chat_admin_invite_links Get the invite links created by an administrator in a chat. As an administrator you can only get your own links you have exported. As the chat or channel owner you can get everyones links. ```APIDOC ## GET /api/chat/admin_invite_links ### Description Retrieves invite links created by administrators in a chat. Administrators can only retrieve their own exported links, while chat/channel owners can retrieve all links. ### Method GET ### Endpoint /api/chat/admin_invite_links ### Parameters #### Query Parameters - **chat_id** (int | str) - Required - Unique identifier for the target chat or username of the target channel/supergroup (in the format @username). You can also use chat public link in form of _t.me/ _ (str). - **admin_id** (int | str) - Required - Unique identifier (int) or username (str) of the target user. For you yourself you can simply use “me” or “self”. For a contact that exists in your Telegram address book you can use his phone number (str). You can also use user profile link in form of _t.me/ _ (str). - **revoked** (bool) - Optional - True, if you want to get revoked links instead. Defaults to False (get active links only). - **limit** (int) - Optional - Limits the number of invite links to be retrieved. By default, no limit is applied and all invite links are returned. ### Response #### Success Response (200) - **ChatInviteLink** (Generator) - A generator yielding ChatInviteLink objects. #### Response Example ```json { "example": "[ChatInviteLink object 1], [ChatInviteLink object 2], ..." } ``` ``` -------------------------------- ### Get Bot Default Privileges Source: https://eymarv.github.io/pyroblack-docs/main/api/methods/get_bot_default_privileges Retrieves the current default privileges of the bot. You can specify whether to get privileges for channels or for groups/supergroups. ```APIDOC ## GET /api/bot/privileges ### Description Get the current default privileges of the bot. ### Method GET ### Endpoint /api/bot/privileges #### Query Parameters - **for_channels** (bool) - Optional - Pass True to get default privileges of the bot in channels. Otherwise, default privileges of the bot for groups and supergroups will be returned. ### Response #### Success Response (200) - **result** (bool) - On success, True is returned. #### Response Example ```json { "result": true } ``` ### Request Example ```python privileges = await app.get_bot_default_privileges(for_channels=True) ``` ``` -------------------------------- ### Client.get_many_listeners_matching_with_identifier_pattern() Source: https://eymarv.github.io/pyroblack-docs/main/api/methods/get_many_listeners_matching_with_identifier_pattern Gets multiple listener that matches the given identifier pattern. This method is intended to get a listener by passing partial info of the listener identifier. ```APIDOC ## Client.get_many_listeners_matching_with_identifier_pattern() ### Description Gets multiple listener that matches the given identifier pattern. This method is intended to get a listener by passing partial info of the listener identifier. ### Method GET ### Endpoint /listeners/match-pattern ### Parameters #### Query Parameters - **pattern** (Identifier) - Required - The Identifier to match agains. - **listener_type** (ListenerTypes) - Required - The type of listener to get. ### Request Example ```json { "pattern": "some_pattern", "listener_type": "some_type" } ``` ### Response #### Success Response (200) - **listeners** (List of Listener) - A list of Listener objects that match the provided pattern and type. #### Response Example ```json { "listeners": [ { "id": "listener_id_1", "type": "some_type", "identifier": "example_identifier_1" }, { "id": "listener_id_2", "type": "some_type", "identifier": "example_identifier_2" } ] } ``` ``` -------------------------------- ### Use Inline Bots: Querying Inline Bots as a User with Pyroblack Source: https://eymarv.github.io/pyroblack-docs/main/start/examples/index Shows how to query an inline bot as a user and send a result to a chat using Pyroblack. This script is runnable after setting up credentials and adjusting session names. ```python # Example: use_inline_bots # Query an inline bot (as user) and send a result to a chat # This is a placeholder for the actual code snippet. # In a real scenario, this would contain Python code # for using inline bots with Pyroblack. ``` -------------------------------- ### Install TgCrypto for pyroblack Source: https://eymarv.github.io/pyroblack-docs/main/topics/speedups Installs the TgCrypto library, a C-based Python extension for pyroblack, which provides high-performance cryptographic algorithms required by Telegram. ```shell pip3 install -U tgcrypto-pyroblack ``` -------------------------------- ### InputMedia Constructors Overview Source: https://eymarv.github.io/pyroblack-docs/main/telegram/base/input-media This section lists the available constructors for the InputMedia base type, each representing a different type of media that can be sent via the Telegram API. ```APIDOC ## InputMedia Constructors ### Description List of available constructors for the `InputMedia` base type. ### Constructors - `InputMediaContact`: Represents a contact media. - `InputMediaDice`: Represents a dice media. - `InputMediaDocument`: Represents a document media. - `InputMediaDocumentExternal`: Represents an external document media. - `InputMediaEmpty`: Represents an empty media. - `InputMediaGame`: Represents a game media. - `InputMediaGeoLive`: Represents a live geolocation media. - `InputMediaGeoPoint`: Represents a geolocation point media. - `InputMediaInvoice`: Represents an invoice media. - `InputMediaPaidMedia`: Represents paid media. - `InputMediaPhoto`: Represents a photo media. - `InputMediaPhotoExternal`: Represents an external photo media. - `InputMediaPoll`: Represents a poll media. - `InputMediaStory`: Represents a story media. - `InputMediaUploadedDocument`: Represents an uploaded document media. - `InputMediaUploadedPhoto`: Represents an uploaded photo media. - `InputMediaVenue`: Represents a venue media. - `InputMediaWebPage`: Represents a web page media. ``` -------------------------------- ### Set Chat Title Example (Python) Source: https://eymarv.github.io/pyroblack-docs/main/api/methods/set_chat_title An example demonstrating how to use the set_chat_title method to change a chat's title. This method requires the chat_id and the new title as parameters. ```python await app.set_chat_title(chat_id, "New Title") ``` -------------------------------- ### Multiple Handlers for Different Filters - Python Source: https://eymarv.github.io/pyroblack-docs/main/topics/use-filters This example shows how multiple handlers can coexist, each triggered by different filters: a '/start' command, a '/help' command, and messages from a specific chat ('OpenFileZ'). ```python @app.on_message(filters.command("start")) async def start_command(client, message): print("This is the /start command") @app.on_message(filters.command("help")) async def help_command(client, message): print("This is the /help command") @app.on_message(filters.chat("OpenFileZ")) async def from_openfiles(client, message): print("New message in @OpenFileZ") ``` -------------------------------- ### Callback Queries: Handling Bot Callback Queries with Pyroblack Source: https://eymarv.github.io/pyroblack-docs/main/start/examples/index Provides functionality for handling callback queries originating from inline button presses when acting as a bot. Users should set up credentials and adjust session names. ```python # Example: callback_queries # Handle callback queries (as bot) coming from inline button presses # This is a placeholder for the actual code snippet. # In a real scenario, this would contain Python code # for handling callback queries with Pyroblack. ``` -------------------------------- ### Echo Bot: Echoing Private Text Messages with Pyroblack Source: https://eymarv.github.io/pyroblack-docs/main/start/examples/index An example script that echoes every private text message received. Users need to configure credentials and potentially adjust session names and target chats. ```python # Example: echo_bot # Echo every private text message # This is a placeholder for the actual code snippet. # In a real scenario, this would contain Python code # for an echo bot using Pyroblack. ``` -------------------------------- ### Smart Plugin Handler Registration - Python Source: https://eymarv.github.io/pyroblack-docs/main/topics/smart-plugins This example shows how to use Pyroblack's Smart Plugins system. Handlers are defined in separate Python files within a 'plugins' directory and registered automatically using the @Client.on_message decorator. The Client is initialized with the plugins directory. ```python from pyrogram import Client, filters @Client.on_message(filters.text & filters.private) async def echo(client, message): await message.reply(message.text) @Client.on_message(filters.text & filters.private, group=1) async def echo_reversed(client, message): await message.reply(message.text[::-1]) ``` ```python from pyrogram import Client plugins = dict(root="plugins") Client("my_account", plugins=plugins).run() ``` -------------------------------- ### Schedule Non-Async Task with Pyroblack and BackgroundScheduler Source: https://eymarv.github.io/pyroblack-docs/main/topics/scheduling Shows how to schedule a Python function to run in the background periodically using APScheduler's BackgroundScheduler with Pyrogram's client. APScheduler needs to be installed (`pip3 install apscheduler`). ```python from apscheduler.schedulers.background import BackgroundScheduler from pyrogram import Client app = Client("my_account") def job(): app.send_message("me", "Hi!") scheduler = BackgroundScheduler() scheduler.add_job(job, "interval", seconds=3) scheduler.start() app.run() ``` -------------------------------- ### Creating an Inline Keyboard Button for a Callback Game Source: https://eymarv.github.io/pyroblack-docs/main/api/types/InlineKeyboardButton This example shows how to create an inline keyboard button specifically for launching a game. The 'text' parameter is the button's label, and 'callback_game' requires a CallbackGame object. This button must be the first in the first row. ```python from pyrogram.types import InlineKeyboardButton, CallbackGame button = InlineKeyboardButton( text="Play Game", callback_game=CallbackGame() ) ``` -------------------------------- ### Load All Plugins by Default in Pyro Black Source: https://eymarv.github.io/pyroblack-docs/main/topics/smart-plugins Demonstrates the default behavior of loading all plugins found in the specified root folder alphabetically. This is the simplest configuration when no specific inclusion or exclusion is needed. ```python plugins = dict(root="plugins") Client("my_account", plugins=plugins).run() ``` -------------------------------- ### Schedule Async Task with Pyroblack and AsyncIOScheduler Source: https://eymarv.github.io/pyroblack-docs/main/topics/scheduling Demonstrates scheduling a Python function to run periodically using APScheduler's AsyncIOScheduler with Pyrogram's asynchronous client. Ensure APScheduler is installed (`pip3 install apscheduler`). ```python from apscheduler.schedulers.asyncio import AsyncIOScheduler from pyrogram import Client app = Client("my_account") async def job(): await app.send_message("me", "Hi!") scheduler = AsyncIOScheduler() scheduler.add_job(job, "interval", seconds=3) scheduler.start() app.run() ``` -------------------------------- ### Translate Message Text Python Examples Source: https://eymarv.github.io/pyroblack-docs/main/api/methods/translate_message_text Demonstrates various ways to use the `translate_message_text()` function in Python. Examples cover translating using chat ID and message IDs, translating plain text, and translating text with Markdown or specific message entities. ```python # Using chat_id and message_ids await app.translate_message_text("en", chat_id, message_ids) # Using text await app.translate_message_text("en", text="Hello, how are you?") # Using text with parse_mode await app.translate_message_text("en", text="*Hello*, how are you?", parse_mode=ParseMode.MARKDOWN) # Using text with entities entities = [types.MessageEntityBold(offset=0, length=5)] await app.translate_message_text("en", text="*Hello*, how are you?", entities=entities) ``` -------------------------------- ### Send Video with Pyro-Black Source: https://eymarv.github.io/pyroblack-docs/main/api/methods/send_video Demonstrates sending a video file using the `send_video` method. Includes examples for adding captions, self-destruct timers, video covers, and progress callbacks. ```python await app.send_video("me", "video.mp4") # Add caption to the video await app.send_video("me", "video.mp4", caption="video caption") # Send self-destructing video await app.send_video("me", "video.mp4", ttl_seconds=10) # Add video_cover to the video await app.send_video(channel_id, "video.mp4", video_cover="coverku.jpg") # Keep track of the progress while uploading async def progress(current, total): print(f"{current * 100 / total:.1f}%") await app.send_video("me", "video.mp4", progress=progress) ``` -------------------------------- ### Get Featured Emoji Stickers Source: https://eymarv.github.io/pyroblack-docs/main/telegram/base/messages/featured-stickers Retrieves a list of featured emoji stickers. ```APIDOC ## GET /api/messages/featuredEmojiStickers ### Description Retrieves a list of featured emoji stickers. ### Method GET ### Endpoint /api/messages/featuredEmojiStickers ### Parameters #### Query Parameters - **hash** (string) - Optional - A hash of the featured emoji stickers. If not provided, the full list will be returned. ### Request Example ``` GET /api/messages/featuredEmojiStickers?hash=0987654321 ``` ### Response #### Success Response (200) - **stickers** (array) - A list of featured emoji sticker objects. #### Response Example ```json { "stickers": [ { "id": 54321, "set_id": 09876, "access_hash": "fedcba0987654321" } ] } ``` ``` -------------------------------- ### Creating an Inline Keyboard Button to Switch to Inline Query Source: https://eymarv.github.io/pyroblack-docs/main/api/types/InlineKeyboardButton This example shows how to create an inline keyboard button that prompts the user to select a chat and inserts a specified inline query. The 'text' parameter is the button's label, and 'switch_inline_query' is the string to be inserted. ```python from pyrogram.types import InlineKeyboardButton button = InlineKeyboardButton( text="Search Inline", switch_inline_query="search_term" ) ``` -------------------------------- ### Get Old Featured Stickers Source: https://eymarv.github.io/pyroblack-docs/main/telegram/base/messages/featured-stickers Retrieves a list of old featured stickers. ```APIDOC ## GET /api/messages/oldFeaturedStickers ### Description Retrieves a list of old featured stickers. ### Method GET ### Endpoint /api/messages/oldFeaturedStickers ### Parameters #### Query Parameters - **offset** (int) - Optional - The offset for fetching older stickers. - **limit** (int) - Optional - The maximum number of stickers to return. ### Request Example ``` GET /api/messages/oldFeaturedStickers?offset=10&limit=20 ``` ### Response #### Success Response (200) - **stickers** (array) - A list of old featured sticker objects. #### Response Example ```json { "stickers": [ { "id": 12345, "set_id": 67890, "access_hash": "abcdef1234567890" } ] } ``` ``` -------------------------------- ### Get Featured Stickers Source: https://eymarv.github.io/pyroblack-docs/main/telegram/base/messages/featured-stickers Retrieves a list of featured stickers for the current user. ```APIDOC ## GET /api/messages/featuredStickers ### Description Retrieves a list of featured stickers for the current user. ### Method GET ### Endpoint /api/messages/featuredStickers ### Parameters #### Query Parameters - **hash** (string) - Optional - A hash of the featured stickers. If not provided, the full list will be returned. ### Request Example ``` GET /api/messages/featuredStickers?hash=1234567890 ``` ### Response #### Success Response (200) - **stickers** (array) - A list of featured sticker objects. - **unread_count** (int) - The number of unread featured stickers. #### Response Example ```json { "stickers": [ { "id": 12345, "set_id": 67890, "access_hash": "abcdef1234567890" } ], "unread_count": 5 } ``` ``` -------------------------------- ### Get Stories By ID Source: https://eymarv.github.io/pyroblack-docs/main/telegram/types/stories/stories Retrieves specific stories by their IDs. ```APIDOC ## GET /stories/by_id ### Description Retrieves specific stories by their IDs. ### Method GET ### Endpoint /stories/by_id ### Parameters #### Query Parameters - **user_id** (int) - Required - The ID of the user whose stories to retrieve. - **story_ids** (List of int) - Required - A list of story IDs to retrieve. ### Response #### Success Response (200) - **count** (int) - The total number of stories found. - **stories** (List of StoryItem) - A list of the requested story items. - **chats** (List of Chat) - A list of chats associated with the stories. - **users** (List of User) - A list of users associated with the stories. #### Response Example ```json { "count": 2, "stories": [ { "id": 1, "user_id": 12345, "date": 1678886400, "expire_date": 1678972800, "media": { "_type": "messageMediaPhoto", "photo": { "_type": "photo", "id": "ABCDEF123456", "access_hash": "XYZ", "file_reference": "...", "date": 1678886400, "sizes": [] } }, "caption": "My pinned story!", "views": 100 }, { "id": 2, "user_id": 12345, "date": 1678790000, "expire_date": 1678876400, "media": { "_type": "messageMediaDocument", "document": { "_type": "document", "id": "GHIJKL789012", "access_hash": "XYZ", "file_reference": "...", "date": 1678790000, "mime_type": "video/mp4", "size": 1000000, "attributes": [] } }, "caption": "Throwback story", "views": 50 } ], "chats": [ { "_type": "user", "id": 12345, "first_name": "John", "last_name": "Doe", "username": "johndoe" } ], "users": [ { "_type": "user", "id": 12345, "first_name": "John", "last_name": "Doe", "username": "johndoe" } ] } ``` ``` -------------------------------- ### Creating an Inline Keyboard Button with a URL Source: https://eymarv.github.io/pyroblack-docs/main/api/types/InlineKeyboardButton This example shows how to create an inline keyboard button that opens a specified URL when pressed. It utilizes the 'text' parameter for the button's label and the 'url' parameter to provide the target URL. ```python from pyrogram.types import InlineKeyboardButton button = InlineKeyboardButton( text="Visit Website", url="https://example.com" ) ```