Added full support of Bot API 8.0

This commit is contained in:
JRoot Junior 2024-11-17 18:23:32 +02:00
parent f2916ca03f
commit 86e4ab235d
No known key found for this signature in database
GPG key ID: 738964250D5FF6E2
36 changed files with 1605 additions and 2 deletions

View file

@ -11,6 +11,14 @@
"html_description": "<p>Use this method to create a link for an invoice. Returns the created invoice link as <em>String</em> on success.</p>",
"rst_description": "Use this method to create a link for an invoice. Returns the created invoice link as *String* on success.",
"annotations": [
{
"type": "String",
"required": false,
"description": "Unique identifier of the business connection on behalf of which the link will be created",
"html_description": "<td>Unique identifier of the business connection on behalf of which the link will be created</td>",
"rst_description": "Unique identifier of the business connection on behalf of which the link will be created\n",
"name": "business_connection_id"
},
{
"type": "String",
"required": true,
@ -59,6 +67,14 @@
"rst_description": "Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in `Telegram Stars <https://t.me/BotNews/90>`_.\n",
"name": "prices"
},
{
"type": "Integer",
"required": false,
"description": "The number of seconds the subscription will be active for before the next payment. The currency must be set to 'XTR' (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified.",
"html_description": "<td>The number of seconds the subscription will be active for before the next payment. The currency must be set to &#8220;XTR&#8221; (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified.</td>",
"rst_description": "The number of seconds the subscription will be active for before the next payment. The currency must be set to 'XTR' (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified.\n",
"name": "subscription_period"
},
{
"type": "Integer",
"required": false,

View file

@ -0,0 +1,41 @@
{
"meta": {},
"group": {
"title": "Payments",
"anchor": "payments"
},
"object": {
"anchor": "edituserstarsubscription",
"name": "editUserStarSubscription",
"description": "Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns True on success.",
"html_description": "<p>Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns <em>True</em> on success.</p>",
"rst_description": "Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns :code:`True` on success.",
"annotations": [
{
"type": "Integer",
"required": true,
"description": "Identifier of the user whose subscription will be edited",
"html_description": "<td>Identifier of the user whose subscription will be edited</td>",
"rst_description": "Identifier of the user whose subscription will be edited\n",
"name": "user_id"
},
{
"type": "String",
"required": true,
"description": "Telegram payment identifier for the subscription",
"html_description": "<td>Telegram payment identifier for the subscription</td>",
"rst_description": "Telegram payment identifier for the subscription\n",
"name": "telegram_payment_charge_id"
},
{
"type": "Boolean",
"required": true,
"description": "Pass True to cancel extension of the user subscription; the subscription must be active up to the end of the current subscription period. Pass False to allow the user to re-enable a subscription that was previously canceled by the bot.",
"html_description": "<td>Pass <em>True</em> to cancel extension of the user subscription; the subscription must be active up to the end of the current subscription period. Pass <em>False</em> to allow the user to re-enable a subscription that was previously canceled by the bot.</td>",
"rst_description": "Pass :code:`True` to cancel extension of the user subscription; the subscription must be active up to the end of the current subscription period. Pass :code:`False` to allow the user to re-enable a subscription that was previously canceled by the bot.\n",
"name": "is_canceled"
}
],
"category": "methods"
}
}

View file

@ -0,0 +1,16 @@
{
"meta": {},
"group": {
"title": "Stickers",
"anchor": "stickers"
},
"object": {
"anchor": "getavailablegifts",
"name": "getAvailableGifts",
"description": "Returns the list of gifts that can be sent by the bot to users. Requires no parameters. Returns a Gifts object.",
"html_description": "<p>Returns the list of gifts that can be sent by the bot to users. Requires no parameters. Returns a <a href=\"#gifts\">Gifts</a> object.</p>",
"rst_description": "Returns the list of gifts that can be sent by the bot to users. Requires no parameters. Returns a :class:`aiogram.types.gifts.Gifts` object.",
"annotations": [],
"category": "methods"
}
}

View file

@ -0,0 +1,65 @@
{
"meta": {},
"group": {
"title": "Inline mode",
"anchor": "inline-mode"
},
"object": {
"anchor": "savepreparedinlinemessage",
"name": "savePreparedInlineMessage",
"description": "Stores a message that can be sent by a user of a Mini App. Returns a PreparedInlineMessage object.",
"html_description": "<p>Stores a message that can be sent by a user of a Mini App. Returns a <a href=\"#preparedinlinemessage\">PreparedInlineMessage</a> object.</p>",
"rst_description": "Stores a message that can be sent by a user of a Mini App. Returns a :class:`aiogram.types.prepared_inline_message.PreparedInlineMessage` object.",
"annotations": [
{
"type": "Integer",
"required": true,
"description": "Unique identifier of the target user that can use the prepared message",
"html_description": "<td>Unique identifier of the target user that can use the prepared message</td>",
"rst_description": "Unique identifier of the target user that can use the prepared message\n",
"name": "user_id"
},
{
"type": "InlineQueryResult",
"required": true,
"description": "A JSON-serialized object describing the message to be sent",
"html_description": "<td>A JSON-serialized object describing the message to be sent</td>",
"rst_description": "A JSON-serialized object describing the message to be sent\n",
"name": "result"
},
{
"type": "Boolean",
"required": false,
"description": "Pass True if the message can be sent to private chats with users",
"html_description": "<td>Pass <em>True</em> if the message can be sent to private chats with users</td>",
"rst_description": "Pass :code:`True` if the message can be sent to private chats with users\n",
"name": "allow_user_chats"
},
{
"type": "Boolean",
"required": false,
"description": "Pass True if the message can be sent to private chats with bots",
"html_description": "<td>Pass <em>True</em> if the message can be sent to private chats with bots</td>",
"rst_description": "Pass :code:`True` if the message can be sent to private chats with bots\n",
"name": "allow_bot_chats"
},
{
"type": "Boolean",
"required": false,
"description": "Pass True if the message can be sent to group and supergroup chats",
"html_description": "<td>Pass <em>True</em> if the message can be sent to group and supergroup chats</td>",
"rst_description": "Pass :code:`True` if the message can be sent to group and supergroup chats\n",
"name": "allow_group_chats"
},
{
"type": "Boolean",
"required": false,
"description": "Pass True if the message can be sent to channel chats",
"html_description": "<td>Pass <em>True</em> if the message can be sent to channel chats</td>",
"rst_description": "Pass :code:`True` if the message can be sent to channel chats\n",
"name": "allow_channel_chats"
}
],
"category": "methods"
}
}

View file

@ -0,0 +1,57 @@
{
"meta": {},
"group": {
"title": "Stickers",
"anchor": "stickers"
},
"object": {
"anchor": "sendgift",
"name": "sendGift",
"description": "Sends a gift to the given user. The gift can't be converted to Telegram Stars by the user. Returns True on success.",
"html_description": "<p>Sends a gift to the given user. The gift can't be converted to Telegram Stars by the user. Returns <em>True</em> on success.</p>",
"rst_description": "Sends a gift to the given user. The gift can't be converted to Telegram Stars by the user. Returns :code:`True` on success.",
"annotations": [
{
"type": "Integer",
"required": true,
"description": "Unique identifier of the target user that will receive the gift",
"html_description": "<td>Unique identifier of the target user that will receive the gift</td>",
"rst_description": "Unique identifier of the target user that will receive the gift\n",
"name": "user_id"
},
{
"type": "String",
"required": true,
"description": "Identifier of the gift",
"html_description": "<td>Identifier of the gift</td>",
"rst_description": "Identifier of the gift\n",
"name": "gift_id"
},
{
"type": "String",
"required": false,
"description": "Text that will be shown along with the gift; 0-255 characters",
"html_description": "<td>Text that will be shown along with the gift; 0-255 characters</td>",
"rst_description": "Text that will be shown along with the gift; 0-255 characters\n",
"name": "text"
},
{
"type": "String",
"required": false,
"description": "Mode for parsing entities in the text. See formatting options for more details. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored.",
"html_description": "<td>Mode for parsing entities in the text. See <a href=\"#formatting-options\">formatting options</a> for more details. Entities other than &#8220;bold&#8221;, &#8220;italic&#8221;, &#8220;underline&#8221;, &#8220;strikethrough&#8221;, &#8220;spoiler&#8221;, and &#8220;custom_emoji&#8221; are ignored.</td>",
"rst_description": "Mode for parsing entities in the text. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored.\n",
"name": "text_parse_mode"
},
{
"type": "Array of MessageEntity",
"required": false,
"description": "A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of text_parse_mode. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored.",
"html_description": "<td>A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of <em>text_parse_mode</em>. Entities other than &#8220;bold&#8221;, &#8220;italic&#8221;, &#8220;underline&#8221;, &#8220;strikethrough&#8221;, &#8220;spoiler&#8221;, and &#8220;custom_emoji&#8221; are ignored.</td>",
"rst_description": "A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of *text_parse_mode*. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored.\n",
"name": "text_entities"
}
],
"category": "methods"
}
}

View file

@ -0,0 +1,41 @@
{
"meta": {},
"group": {
"title": "Available methods",
"anchor": "available-methods"
},
"object": {
"anchor": "setuseremojistatus",
"name": "setUserEmojiStatus",
"description": "Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess. Returns True on success.",
"html_description": "<p>Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method <a href=\"/bots/webapps#initializing-mini-apps\">requestEmojiStatusAccess</a>. Returns <em>True</em> on success.</p>",
"rst_description": "Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method `requestEmojiStatusAccess <https://core.telegram.org/bots/webapps#initializing-mini-apps>`_. Returns :code:`True` on success.",
"annotations": [
{
"type": "Integer",
"required": true,
"description": "Unique identifier of the target user",
"html_description": "<td>Unique identifier of the target user</td>",
"rst_description": "Unique identifier of the target user\n",
"name": "user_id"
},
{
"type": "String",
"required": false,
"description": "Custom emoji identifier of the emoji status to set. Pass an empty string to remove the status.",
"html_description": "<td>Custom emoji identifier of the emoji status to set. Pass an empty string to remove the status.</td>",
"rst_description": "Custom emoji identifier of the emoji status to set. Pass an empty string to remove the status.\n",
"name": "emoji_status_custom_emoji_id"
},
{
"type": "Integer",
"required": false,
"description": "Expiration date of the emoji status, if any",
"html_description": "<td>Expiration date of the emoji status, if any</td>",
"rst_description": "Expiration date of the emoji status, if any\n",
"name": "emoji_status_expiration_date"
}
],
"category": "methods"
}
}

View file

@ -1,7 +1,7 @@
{
"api": {
"version": "7.11",
"release_date": "2024-10-31"
"version": "8.0",
"release_date": "2024-11-17"
},
"items": [
{
@ -10122,6 +10122,40 @@
],
"category": "methods"
},
{
"anchor": "setuseremojistatus",
"name": "setUserEmojiStatus",
"description": "Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method requestEmojiStatusAccess. Returns True on success.",
"html_description": "<p>Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method <a href=\"/bots/webapps#initializing-mini-apps\">requestEmojiStatusAccess</a>. Returns <em>True</em> on success.</p>",
"rst_description": "Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method `requestEmojiStatusAccess <https://core.telegram.org/bots/webapps#initializing-mini-apps>`_. Returns :code:`True` on success.",
"annotations": [
{
"type": "Integer",
"required": true,
"description": "Unique identifier of the target user",
"html_description": "<td>Unique identifier of the target user</td>",
"rst_description": "Unique identifier of the target user\n",
"name": "user_id"
},
{
"type": "String",
"required": false,
"description": "Custom emoji identifier of the emoji status to set. Pass an empty string to remove the status.",
"html_description": "<td>Custom emoji identifier of the emoji status to set. Pass an empty string to remove the status.</td>",
"rst_description": "Custom emoji identifier of the emoji status to set. Pass an empty string to remove the status.\n",
"name": "emoji_status_custom_emoji_id"
},
{
"type": "Integer",
"required": false,
"description": "Expiration date of the emoji status, if any",
"html_description": "<td>Expiration date of the emoji status, if any</td>",
"rst_description": "Expiration date of the emoji status, if any\n",
"name": "emoji_status_expiration_date"
}
],
"category": "methods"
},
{
"anchor": "getfile",
"name": "getFile",
@ -13192,6 +13226,133 @@
}
],
"category": "methods"
},
{
"anchor": "gift",
"name": "Gift",
"description": "This object represents a gift that can be sent by the bot.",
"html_description": "<p>This object represents a gift that can be sent by the bot.</p>",
"rst_description": "This object represents a gift that can be sent by the bot.",
"annotations": [
{
"type": "String",
"description": "Unique identifier of the gift",
"html_description": "<td>Unique identifier of the gift</td>",
"rst_description": "Unique identifier of the gift\n",
"name": "id",
"required": true
},
{
"type": "Sticker",
"description": "The sticker that represents the gift",
"html_description": "<td>The sticker that represents the gift</td>",
"rst_description": "The sticker that represents the gift\n",
"name": "sticker",
"required": true
},
{
"type": "Integer",
"description": "The number of Telegram Stars that must be paid to send the sticker",
"html_description": "<td>The number of Telegram Stars that must be paid to send the sticker</td>",
"rst_description": "The number of Telegram Stars that must be paid to send the sticker\n",
"name": "star_count",
"required": true
},
{
"type": "Integer",
"description": "The total number of the gifts of this type that can be sent; for limited gifts only",
"html_description": "<td><em>Optional</em>. The total number of the gifts of this type that can be sent; for limited gifts only</td>",
"rst_description": "*Optional*. The total number of the gifts of this type that can be sent; for limited gifts only\n",
"name": "total_count",
"required": false
},
{
"type": "Integer",
"description": "The number of remaining gifts of this type that can be sent; for limited gifts only",
"html_description": "<td><em>Optional</em>. The number of remaining gifts of this type that can be sent; for limited gifts only</td>",
"rst_description": "*Optional*. The number of remaining gifts of this type that can be sent; for limited gifts only\n",
"name": "remaining_count",
"required": false
}
],
"category": "types"
},
{
"anchor": "gifts",
"name": "Gifts",
"description": "This object represent a list of gifts.",
"html_description": "<p>This object represent a list of gifts.</p>",
"rst_description": "This object represent a list of gifts.",
"annotations": [
{
"type": "Array of Gift",
"description": "The list of gifts",
"html_description": "<td>The list of gifts</td>",
"rst_description": "The list of gifts\n",
"name": "gifts",
"required": true
}
],
"category": "types"
},
{
"anchor": "getavailablegifts",
"name": "getAvailableGifts",
"description": "Returns the list of gifts that can be sent by the bot to users. Requires no parameters. Returns a Gifts object.",
"html_description": "<p>Returns the list of gifts that can be sent by the bot to users. Requires no parameters. Returns a <a href=\"#gifts\">Gifts</a> object.</p>",
"rst_description": "Returns the list of gifts that can be sent by the bot to users. Requires no parameters. Returns a :class:`aiogram.types.gifts.Gifts` object.",
"annotations": [],
"category": "methods"
},
{
"anchor": "sendgift",
"name": "sendGift",
"description": "Sends a gift to the given user. The gift can't be converted to Telegram Stars by the user. Returns True on success.",
"html_description": "<p>Sends a gift to the given user. The gift can't be converted to Telegram Stars by the user. Returns <em>True</em> on success.</p>",
"rst_description": "Sends a gift to the given user. The gift can't be converted to Telegram Stars by the user. Returns :code:`True` on success.",
"annotations": [
{
"type": "Integer",
"required": true,
"description": "Unique identifier of the target user that will receive the gift",
"html_description": "<td>Unique identifier of the target user that will receive the gift</td>",
"rst_description": "Unique identifier of the target user that will receive the gift\n",
"name": "user_id"
},
{
"type": "String",
"required": true,
"description": "Identifier of the gift",
"html_description": "<td>Identifier of the gift</td>",
"rst_description": "Identifier of the gift\n",
"name": "gift_id"
},
{
"type": "String",
"required": false,
"description": "Text that will be shown along with the gift; 0-255 characters",
"html_description": "<td>Text that will be shown along with the gift; 0-255 characters</td>",
"rst_description": "Text that will be shown along with the gift; 0-255 characters\n",
"name": "text"
},
{
"type": "String",
"required": false,
"description": "Mode for parsing entities in the text. See formatting options for more details. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored.",
"html_description": "<td>Mode for parsing entities in the text. See <a href=\"#formatting-options\">formatting options</a> for more details. Entities other than &#8220;bold&#8221;, &#8220;italic&#8221;, &#8220;underline&#8221;, &#8220;strikethrough&#8221;, &#8220;spoiler&#8221;, and &#8220;custom_emoji&#8221; are ignored.</td>",
"rst_description": "Mode for parsing entities in the text. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored.\n",
"name": "text_parse_mode"
},
{
"type": "Array of MessageEntity",
"required": false,
"description": "A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of text_parse_mode. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored.",
"html_description": "<td>A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of <em>text_parse_mode</em>. Entities other than &#8220;bold&#8221;, &#8220;italic&#8221;, &#8220;underline&#8221;, &#8220;strikethrough&#8221;, &#8220;spoiler&#8221;, and &#8220;custom_emoji&#8221; are ignored.</td>",
"rst_description": "A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of *text_parse_mode*. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored.\n",
"name": "text_entities"
}
],
"category": "methods"
}
],
"description": "The following methods and objects allow your bot to handle stickers and sticker sets."
@ -15839,6 +16000,90 @@
}
],
"category": "types"
},
{
"anchor": "savepreparedinlinemessage",
"name": "savePreparedInlineMessage",
"description": "Stores a message that can be sent by a user of a Mini App. Returns a PreparedInlineMessage object.",
"html_description": "<p>Stores a message that can be sent by a user of a Mini App. Returns a <a href=\"#preparedinlinemessage\">PreparedInlineMessage</a> object.</p>",
"rst_description": "Stores a message that can be sent by a user of a Mini App. Returns a :class:`aiogram.types.prepared_inline_message.PreparedInlineMessage` object.",
"annotations": [
{
"type": "Integer",
"required": true,
"description": "Unique identifier of the target user that can use the prepared message",
"html_description": "<td>Unique identifier of the target user that can use the prepared message</td>",
"rst_description": "Unique identifier of the target user that can use the prepared message\n",
"name": "user_id"
},
{
"type": "InlineQueryResult",
"required": true,
"description": "A JSON-serialized object describing the message to be sent",
"html_description": "<td>A JSON-serialized object describing the message to be sent</td>",
"rst_description": "A JSON-serialized object describing the message to be sent\n",
"name": "result"
},
{
"type": "Boolean",
"required": false,
"description": "Pass True if the message can be sent to private chats with users",
"html_description": "<td>Pass <em>True</em> if the message can be sent to private chats with users</td>",
"rst_description": "Pass :code:`True` if the message can be sent to private chats with users\n",
"name": "allow_user_chats"
},
{
"type": "Boolean",
"required": false,
"description": "Pass True if the message can be sent to private chats with bots",
"html_description": "<td>Pass <em>True</em> if the message can be sent to private chats with bots</td>",
"rst_description": "Pass :code:`True` if the message can be sent to private chats with bots\n",
"name": "allow_bot_chats"
},
{
"type": "Boolean",
"required": false,
"description": "Pass True if the message can be sent to group and supergroup chats",
"html_description": "<td>Pass <em>True</em> if the message can be sent to group and supergroup chats</td>",
"rst_description": "Pass :code:`True` if the message can be sent to group and supergroup chats\n",
"name": "allow_group_chats"
},
{
"type": "Boolean",
"required": false,
"description": "Pass True if the message can be sent to channel chats",
"html_description": "<td>Pass <em>True</em> if the message can be sent to channel chats</td>",
"rst_description": "Pass :code:`True` if the message can be sent to channel chats\n",
"name": "allow_channel_chats"
}
],
"category": "methods"
},
{
"anchor": "preparedinlinemessage",
"name": "PreparedInlineMessage",
"description": "Describes an inline message to be sent by a user of a Mini App.",
"html_description": "<p>Describes an inline message to be sent by a user of a Mini App.</p>",
"rst_description": "Describes an inline message to be sent by a user of a Mini App.",
"annotations": [
{
"type": "String",
"description": "Unique identifier of the prepared message",
"html_description": "<td>Unique identifier of the prepared message</td>",
"rst_description": "Unique identifier of the prepared message\n",
"name": "id",
"required": true
},
{
"type": "Integer",
"description": "Expiration date of the prepared message, in Unix time. Expired prepared messages can no longer be used",
"html_description": "<td>Expiration date of the prepared message, in Unix time. Expired prepared messages can no longer be used</td>",
"rst_description": "Expiration date of the prepared message, in Unix time. Expired prepared messages can no longer be used\n",
"name": "expiration_date",
"required": true
}
],
"category": "types"
}
],
"description": "The following methods and objects allow your bot to work in inline mode.\nPlease see our Introduction to Inline bots for more details.\nTo enable this option, send the /setinline command to @BotFather and provide the placeholder text that the user will see in the input field after typing your bot's name."
@ -16096,6 +16341,14 @@
"html_description": "<p>Use this method to create a link for an invoice. Returns the created invoice link as <em>String</em> on success.</p>",
"rst_description": "Use this method to create a link for an invoice. Returns the created invoice link as *String* on success.",
"annotations": [
{
"type": "String",
"required": false,
"description": "Unique identifier of the business connection on behalf of which the link will be created",
"html_description": "<td>Unique identifier of the business connection on behalf of which the link will be created</td>",
"rst_description": "Unique identifier of the business connection on behalf of which the link will be created\n",
"name": "business_connection_id"
},
{
"type": "String",
"required": true,
@ -16144,6 +16397,14 @@
"rst_description": "Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in `Telegram Stars <https://t.me/BotNews/90>`_.\n",
"name": "prices"
},
{
"type": "Integer",
"required": false,
"description": "The number of seconds the subscription will be active for before the next payment. The currency must be set to 'XTR' (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified.",
"html_description": "<td>The number of seconds the subscription will be active for before the next payment. The currency must be set to &#8220;XTR&#8221; (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified.</td>",
"rst_description": "The number of seconds the subscription will be active for before the next payment. The currency must be set to 'XTR' (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified.\n",
"name": "subscription_period"
},
{
"type": "Integer",
"required": false,
@ -16387,6 +16648,40 @@
],
"category": "methods"
},
{
"anchor": "edituserstarsubscription",
"name": "editUserStarSubscription",
"description": "Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns True on success.",
"html_description": "<p>Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns <em>True</em> on success.</p>",
"rst_description": "Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns :code:`True` on success.",
"annotations": [
{
"type": "Integer",
"required": true,
"description": "Identifier of the user whose subscription will be edited",
"html_description": "<td>Identifier of the user whose subscription will be edited</td>",
"rst_description": "Identifier of the user whose subscription will be edited\n",
"name": "user_id"
},
{
"type": "String",
"required": true,
"description": "Telegram payment identifier for the subscription",
"html_description": "<td>Telegram payment identifier for the subscription</td>",
"rst_description": "Telegram payment identifier for the subscription\n",
"name": "telegram_payment_charge_id"
},
{
"type": "Boolean",
"required": true,
"description": "Pass True to cancel extension of the user subscription; the subscription must be active up to the end of the current subscription period. Pass False to allow the user to re-enable a subscription that was previously canceled by the bot.",
"html_description": "<td>Pass <em>True</em> to cancel extension of the user subscription; the subscription must be active up to the end of the current subscription period. Pass <em>False</em> to allow the user to re-enable a subscription that was previously canceled by the bot.</td>",
"rst_description": "Pass :code:`True` to cancel extension of the user subscription; the subscription must be active up to the end of the current subscription period. Pass :code:`False` to allow the user to re-enable a subscription that was previously canceled by the bot.\n",
"name": "is_canceled"
}
],
"category": "methods"
},
{
"anchor": "labeledprice",
"name": "LabeledPrice",
@ -16628,6 +16923,30 @@
"name": "invoice_payload",
"required": true
},
{
"type": "Integer",
"description": "Expiration date of the subscription, in Unix time; for recurring payments only",
"html_description": "<td><em>Optional</em>. Expiration date of the subscription, in Unix time; for recurring payments only</td>",
"rst_description": "*Optional*. Expiration date of the subscription, in Unix time; for recurring payments only\n",
"name": "subscription_expiration_date",
"required": false
},
{
"type": "True",
"description": "True, if the payment is a recurring payment for a subscription",
"html_description": "<td><em>Optional</em>. True, if the payment is a recurring payment for a subscription</td>",
"rst_description": "*Optional*. True, if the payment is a recurring payment for a subscription\n",
"name": "is_recurring",
"required": false
},
{
"type": "True",
"description": "True, if the payment is the first payment for a subscription",
"html_description": "<td><em>Optional</em>. True, if the payment is the first payment for a subscription</td>",
"rst_description": "*Optional*. True, if the payment is the first payment for a subscription\n",
"name": "is_first_recurring",
"required": false
},
{
"type": "String",
"description": "Identifier of the shipping option chosen by the user",
@ -16966,6 +17285,14 @@
"name": "invoice_payload",
"required": false
},
{
"type": "Integer",
"description": "The duration of the paid subscription",
"html_description": "<td><em>Optional</em>. The duration of the paid subscription</td>",
"rst_description": "*Optional*. The duration of the paid subscription\n",
"name": "subscription_period",
"required": false
},
{
"type": "Array of PaidMedia",
"description": "Information about the paid media bought by the user",
@ -16981,6 +17308,14 @@
"rst_description": "*Optional*. Bot-specified paid media payload\n",
"name": "paid_media_payload",
"required": false
},
{
"type": "String",
"description": "The gift sent to the user by the bot",
"html_description": "<td><em>Optional</em>. The gift sent to the user by the bot</td>",
"rst_description": "*Optional*. The gift sent to the user by the bot\n",
"name": "gift",
"required": false
}
],
"category": "types"

View file

@ -0,0 +1,57 @@
{
"meta": {},
"group": {
"title": "Stickers",
"anchor": "stickers"
},
"object": {
"anchor": "gift",
"name": "Gift",
"description": "This object represents a gift that can be sent by the bot.",
"html_description": "<p>This object represents a gift that can be sent by the bot.</p>",
"rst_description": "This object represents a gift that can be sent by the bot.",
"annotations": [
{
"type": "String",
"description": "Unique identifier of the gift",
"html_description": "<td>Unique identifier of the gift</td>",
"rst_description": "Unique identifier of the gift\n",
"name": "id",
"required": true
},
{
"type": "Sticker",
"description": "The sticker that represents the gift",
"html_description": "<td>The sticker that represents the gift</td>",
"rst_description": "The sticker that represents the gift\n",
"name": "sticker",
"required": true
},
{
"type": "Integer",
"description": "The number of Telegram Stars that must be paid to send the sticker",
"html_description": "<td>The number of Telegram Stars that must be paid to send the sticker</td>",
"rst_description": "The number of Telegram Stars that must be paid to send the sticker\n",
"name": "star_count",
"required": true
},
{
"type": "Integer",
"description": "The total number of the gifts of this type that can be sent; for limited gifts only",
"html_description": "<td><em>Optional</em>. The total number of the gifts of this type that can be sent; for limited gifts only</td>",
"rst_description": "*Optional*. The total number of the gifts of this type that can be sent; for limited gifts only\n",
"name": "total_count",
"required": false
},
{
"type": "Integer",
"description": "The number of remaining gifts of this type that can be sent; for limited gifts only",
"html_description": "<td><em>Optional</em>. The number of remaining gifts of this type that can be sent; for limited gifts only</td>",
"rst_description": "*Optional*. The number of remaining gifts of this type that can be sent; for limited gifts only\n",
"name": "remaining_count",
"required": false
}
],
"category": "types"
}
}

View file

@ -0,0 +1,25 @@
{
"meta": {},
"group": {
"title": "Stickers",
"anchor": "stickers"
},
"object": {
"anchor": "gifts",
"name": "Gifts",
"description": "This object represent a list of gifts.",
"html_description": "<p>This object represent a list of gifts.</p>",
"rst_description": "This object represent a list of gifts.",
"annotations": [
{
"type": "Array of Gift",
"description": "The list of gifts",
"html_description": "<td>The list of gifts</td>",
"rst_description": "The list of gifts\n",
"name": "gifts",
"required": true
}
],
"category": "types"
}
}

View file

@ -0,0 +1,33 @@
{
"meta": {},
"group": {
"title": "Inline mode",
"anchor": "inline-mode"
},
"object": {
"anchor": "preparedinlinemessage",
"name": "PreparedInlineMessage",
"description": "Describes an inline message to be sent by a user of a Mini App.",
"html_description": "<p>Describes an inline message to be sent by a user of a Mini App.</p>",
"rst_description": "Describes an inline message to be sent by a user of a Mini App.",
"annotations": [
{
"type": "String",
"description": "Unique identifier of the prepared message",
"html_description": "<td>Unique identifier of the prepared message</td>",
"rst_description": "Unique identifier of the prepared message\n",
"name": "id",
"required": true
},
{
"type": "Integer",
"description": "Expiration date of the prepared message, in Unix time. Expired prepared messages can no longer be used",
"html_description": "<td>Expiration date of the prepared message, in Unix time. Expired prepared messages can no longer be used</td>",
"rst_description": "Expiration date of the prepared message, in Unix time. Expired prepared messages can no longer be used\n",
"name": "expiration_date",
"required": true
}
],
"category": "types"
}
}

View file

@ -35,6 +35,30 @@
"name": "invoice_payload",
"required": true
},
{
"type": "Integer",
"description": "Expiration date of the subscription, in Unix time; for recurring payments only",
"html_description": "<td><em>Optional</em>. Expiration date of the subscription, in Unix time; for recurring payments only</td>",
"rst_description": "*Optional*. Expiration date of the subscription, in Unix time; for recurring payments only\n",
"name": "subscription_expiration_date",
"required": false
},
{
"type": "True",
"description": "True, if the payment is a recurring payment for a subscription",
"html_description": "<td><em>Optional</em>. True, if the payment is a recurring payment for a subscription</td>",
"rst_description": "*Optional*. True, if the payment is a recurring payment for a subscription\n",
"name": "is_recurring",
"required": false
},
{
"type": "True",
"description": "True, if the payment is the first payment for a subscription",
"html_description": "<td><em>Optional</em>. True, if the payment is the first payment for a subscription</td>",
"rst_description": "*Optional*. True, if the payment is the first payment for a subscription\n",
"name": "is_first_recurring",
"required": false
},
{
"type": "String",
"description": "Identifier of the shipping option chosen by the user",

View file

@ -35,6 +35,14 @@
"name": "invoice_payload",
"required": false
},
{
"type": "Integer",
"description": "The duration of the paid subscription",
"html_description": "<td><em>Optional</em>. The duration of the paid subscription</td>",
"rst_description": "*Optional*. The duration of the paid subscription\n",
"name": "subscription_period",
"required": false
},
{
"type": "Array of PaidMedia",
"description": "Information about the paid media bought by the user",
@ -50,6 +58,14 @@
"rst_description": "*Optional*. Bot-specified paid media payload\n",
"name": "paid_media_payload",
"required": false
},
{
"type": "String",
"description": "The gift sent to the user by the bot",
"html_description": "<td><em>Optional</em>. The gift sent to the user by the bot</td>",
"rst_description": "*Optional*. The gift sent to the user by the bot\n",
"name": "gift",
"required": false
}
],
"category": "types"

View file

@ -60,9 +60,11 @@ from ..methods import (
EditMessageMedia,
EditMessageReplyMarkup,
EditMessageText,
EditUserStarSubscription,
ExportChatInviteLink,
ForwardMessage,
ForwardMessages,
GetAvailableGifts,
GetBusinessConnection,
GetChat,
GetChatAdministrators,
@ -96,6 +98,7 @@ from ..methods import (
ReplaceStickerInSet,
RestrictChatMember,
RevokeChatInviteLink,
SavePreparedInlineMessage,
SendAnimation,
SendAudio,
SendChatAction,
@ -103,6 +106,7 @@ from ..methods import (
SendDice,
SendDocument,
SendGame,
SendGift,
SendInvoice,
SendLocation,
SendMediaGroup,
@ -137,6 +141,7 @@ from ..methods import (
SetStickerPositionInSet,
SetStickerSetThumbnail,
SetStickerSetTitle,
SetUserEmojiStatus,
SetWebhook,
StopMessageLiveLocation,
StopPoll,
@ -178,6 +183,7 @@ from ..types import (
ForceReply,
ForumTopic,
GameHighScore,
Gifts,
InlineKeyboardMarkup,
InlineQueryResultArticle,
InlineQueryResultAudio,
@ -229,6 +235,7 @@ from ..types import (
PassportElementErrorTranslationFiles,
PassportElementErrorUnspecified,
Poll,
PreparedInlineMessage,
ReactionTypeCustomEmoji,
ReactionTypeEmoji,
ReactionTypePaid,
@ -978,7 +985,9 @@ class Bot:
payload: str,
currency: str,
prices: list[LabeledPrice],
business_connection_id: Optional[str] = None,
provider_token: Optional[str] = None,
subscription_period: Optional[int] = None,
max_tip_amount: Optional[int] = None,
suggested_tip_amounts: Optional[list[int]] = None,
provider_data: Optional[str] = None,
@ -1005,7 +1014,9 @@ class Bot:
:param payload: Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use it for your internal processes.
:param currency: Three-letter ISO 4217 currency code, see `more on currencies <https://core.telegram.org/bots/payments#supported-currencies>`_. Pass 'XTR' for payments in `Telegram Stars <https://t.me/BotNews/90>`_.
:param prices: Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in `Telegram Stars <https://t.me/BotNews/90>`_.
:param business_connection_id: Unique identifier of the business connection on behalf of which the link will be created
:param provider_token: Payment provider token, obtained via `@BotFather <https://t.me/botfather>`_. Pass an empty string for payments in `Telegram Stars <https://t.me/BotNews/90>`_.
:param subscription_period: The number of seconds the subscription will be active for before the next payment. The currency must be set to 'XTR' (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified.
:param max_tip_amount: The maximum accepted amount for tips in the *smallest units* of the currency (integer, **not** float/double). For example, for a maximum tip of :code:`US$ 1.45` pass :code:`max_tip_amount = 145`. See the *exp* parameter in `currencies.json <https://core.telegram.org/bots/payments/currencies.json>`_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in `Telegram Stars <https://t.me/BotNews/90>`_.
:param suggested_tip_amounts: A JSON-serialized array of suggested amounts of tips in the *smallest units* of the currency (integer, **not** float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed *max_tip_amount*.
:param provider_data: JSON-serialized data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider.
@ -1030,7 +1041,9 @@ class Bot:
payload=payload,
currency=currency,
prices=prices,
business_connection_id=business_connection_id,
provider_token=provider_token,
subscription_period=subscription_period,
max_tip_amount=max_tip_amount,
suggested_tip_amounts=suggested_tip_amounts,
provider_data=provider_data,
@ -4820,3 +4833,159 @@ class Bot:
name=name,
)
return await self(call, request_timeout=request_timeout)
async def edit_user_star_subscription(
self,
user_id: int,
telegram_payment_charge_id: str,
is_canceled: bool,
request_timeout: Optional[int] = None,
) -> bool:
"""
Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#edituserstarsubscription
:param user_id: Identifier of the user whose subscription will be edited
:param telegram_payment_charge_id: Telegram payment identifier for the subscription
:param is_canceled: Pass :code:`True` to cancel extension of the user subscription; the subscription must be active up to the end of the current subscription period. Pass :code:`False` to allow the user to re-enable a subscription that was previously canceled by the bot.
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
call = EditUserStarSubscription(
user_id=user_id,
telegram_payment_charge_id=telegram_payment_charge_id,
is_canceled=is_canceled,
)
return await self(call, request_timeout=request_timeout)
async def get_available_gifts(
self,
request_timeout: Optional[int] = None,
) -> Gifts:
"""
Returns the list of gifts that can be sent by the bot to users. Requires no parameters. Returns a :class:`aiogram.types.gifts.Gifts` object.
Source: https://core.telegram.org/bots/api#getavailablegifts
:param request_timeout: Request timeout
:return: Returns a :class:`aiogram.types.gifts.Gifts` object.
"""
call = GetAvailableGifts()
return await self(call, request_timeout=request_timeout)
async def save_prepared_inline_message(
self,
user_id: int,
result: Union[
InlineQueryResultCachedAudio,
InlineQueryResultCachedDocument,
InlineQueryResultCachedGif,
InlineQueryResultCachedMpeg4Gif,
InlineQueryResultCachedPhoto,
InlineQueryResultCachedSticker,
InlineQueryResultCachedVideo,
InlineQueryResultCachedVoice,
InlineQueryResultArticle,
InlineQueryResultAudio,
InlineQueryResultContact,
InlineQueryResultGame,
InlineQueryResultDocument,
InlineQueryResultGif,
InlineQueryResultLocation,
InlineQueryResultMpeg4Gif,
InlineQueryResultPhoto,
InlineQueryResultVenue,
InlineQueryResultVideo,
InlineQueryResultVoice,
],
allow_user_chats: Optional[bool] = None,
allow_bot_chats: Optional[bool] = None,
allow_group_chats: Optional[bool] = None,
allow_channel_chats: Optional[bool] = None,
request_timeout: Optional[int] = None,
) -> PreparedInlineMessage:
"""
Stores a message that can be sent by a user of a Mini App. Returns a :class:`aiogram.types.prepared_inline_message.PreparedInlineMessage` object.
Source: https://core.telegram.org/bots/api#savepreparedinlinemessage
:param user_id: Unique identifier of the target user that can use the prepared message
:param result: A JSON-serialized object describing the message to be sent
:param allow_user_chats: Pass :code:`True` if the message can be sent to private chats with users
:param allow_bot_chats: Pass :code:`True` if the message can be sent to private chats with bots
:param allow_group_chats: Pass :code:`True` if the message can be sent to group and supergroup chats
:param allow_channel_chats: Pass :code:`True` if the message can be sent to channel chats
:param request_timeout: Request timeout
:return: Returns a :class:`aiogram.types.prepared_inline_message.PreparedInlineMessage` object.
"""
call = SavePreparedInlineMessage(
user_id=user_id,
result=result,
allow_user_chats=allow_user_chats,
allow_bot_chats=allow_bot_chats,
allow_group_chats=allow_group_chats,
allow_channel_chats=allow_channel_chats,
)
return await self(call, request_timeout=request_timeout)
async def send_gift(
self,
user_id: int,
gift_id: str,
text: Optional[str] = None,
text_parse_mode: Optional[str] = None,
text_entities: Optional[list[MessageEntity]] = None,
request_timeout: Optional[int] = None,
) -> bool:
"""
Sends a gift to the given user. The gift can't be converted to Telegram Stars by the user. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#sendgift
:param user_id: Unique identifier of the target user that will receive the gift
:param gift_id: Identifier of the gift
:param text: Text that will be shown along with the gift; 0-255 characters
:param text_parse_mode: Mode for parsing entities in the text. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored.
:param text_entities: A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of *text_parse_mode*. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored.
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
call = SendGift(
user_id=user_id,
gift_id=gift_id,
text=text,
text_parse_mode=text_parse_mode,
text_entities=text_entities,
)
return await self(call, request_timeout=request_timeout)
async def set_user_emoji_status(
self,
user_id: int,
emoji_status_custom_emoji_id: Optional[str] = None,
emoji_status_expiration_date: Optional[int] = None,
request_timeout: Optional[int] = None,
) -> bool:
"""
Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method `requestEmojiStatusAccess <https://core.telegram.org/bots/webapps#initializing-mini-apps>`_. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setuseremojistatus
:param user_id: Unique identifier of the target user
:param emoji_status_custom_emoji_id: Custom emoji identifier of the emoji status to set. Pass an empty string to remove the status.
:param emoji_status_expiration_date: Expiration date of the emoji status, if any
:param request_timeout: Request timeout
:return: Returns :code:`True` on success.
"""
call = SetUserEmojiStatus(
user_id=user_id,
emoji_status_custom_emoji_id=emoji_status_custom_emoji_id,
emoji_status_expiration_date=emoji_status_expiration_date,
)
return await self(call, request_timeout=request_timeout)

View file

@ -37,9 +37,11 @@ from .edit_message_live_location import EditMessageLiveLocation
from .edit_message_media import EditMessageMedia
from .edit_message_reply_markup import EditMessageReplyMarkup
from .edit_message_text import EditMessageText
from .edit_user_star_subscription import EditUserStarSubscription
from .export_chat_invite_link import ExportChatInviteLink
from .forward_message import ForwardMessage
from .forward_messages import ForwardMessages
from .get_available_gifts import GetAvailableGifts
from .get_business_connection import GetBusinessConnection
from .get_chat import GetChat
from .get_chat_administrators import GetChatAdministrators
@ -73,6 +75,7 @@ from .reopen_general_forum_topic import ReopenGeneralForumTopic
from .replace_sticker_in_set import ReplaceStickerInSet
from .restrict_chat_member import RestrictChatMember
from .revoke_chat_invite_link import RevokeChatInviteLink
from .save_prepared_inline_message import SavePreparedInlineMessage
from .send_animation import SendAnimation
from .send_audio import SendAudio
from .send_chat_action import SendChatAction
@ -80,6 +83,7 @@ from .send_contact import SendContact
from .send_dice import SendDice
from .send_document import SendDocument
from .send_game import SendGame
from .send_gift import SendGift
from .send_invoice import SendInvoice
from .send_location import SendLocation
from .send_media_group import SendMediaGroup
@ -114,6 +118,7 @@ from .set_sticker_mask_position import SetStickerMaskPosition
from .set_sticker_position_in_set import SetStickerPositionInSet
from .set_sticker_set_thumbnail import SetStickerSetThumbnail
from .set_sticker_set_title import SetStickerSetTitle
from .set_user_emoji_status import SetUserEmojiStatus
from .set_webhook import SetWebhook
from .stop_message_live_location import StopMessageLiveLocation
from .stop_poll import StopPoll
@ -165,9 +170,11 @@ __all__ = (
"EditMessageMedia",
"EditMessageReplyMarkup",
"EditMessageText",
"EditUserStarSubscription",
"ExportChatInviteLink",
"ForwardMessage",
"ForwardMessages",
"GetAvailableGifts",
"GetBusinessConnection",
"GetChat",
"GetChatAdministrators",
@ -203,6 +210,7 @@ __all__ = (
"Response",
"RestrictChatMember",
"RevokeChatInviteLink",
"SavePreparedInlineMessage",
"SendAnimation",
"SendAudio",
"SendChatAction",
@ -210,6 +218,7 @@ __all__ = (
"SendDice",
"SendDocument",
"SendGame",
"SendGift",
"SendInvoice",
"SendLocation",
"SendMediaGroup",
@ -244,6 +253,7 @@ __all__ = (
"SetStickerPositionInSet",
"SetStickerSetThumbnail",
"SetStickerSetTitle",
"SetUserEmojiStatus",
"SetWebhook",
"StopMessageLiveLocation",
"StopPoll",

View file

@ -26,8 +26,12 @@ class CreateInvoiceLink(TelegramMethod[str]):
"""Three-letter ISO 4217 currency code, see `more on currencies <https://core.telegram.org/bots/payments#supported-currencies>`_. Pass 'XTR' for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
prices: list[LabeledPrice]
"""Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.). Must contain exactly one item for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
business_connection_id: Optional[str] = None
"""Unique identifier of the business connection on behalf of which the link will be created"""
provider_token: Optional[str] = None
"""Payment provider token, obtained via `@BotFather <https://t.me/botfather>`_. Pass an empty string for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
subscription_period: Optional[int] = None
"""The number of seconds the subscription will be active for before the next payment. The currency must be set to 'XTR' (Telegram Stars) if the parameter is used. Currently, it must always be 2592000 (30 days) if specified."""
max_tip_amount: Optional[int] = None
"""The maximum accepted amount for tips in the *smallest units* of the currency (integer, **not** float/double). For example, for a maximum tip of :code:`US$ 1.45` pass :code:`max_tip_amount = 145`. See the *exp* parameter in `currencies.json <https://core.telegram.org/bots/payments/currencies.json>`_, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0. Not supported for payments in `Telegram Stars <https://t.me/BotNews/90>`_."""
suggested_tip_amounts: Optional[list[int]] = None
@ -69,7 +73,9 @@ class CreateInvoiceLink(TelegramMethod[str]):
payload: str,
currency: str,
prices: list[LabeledPrice],
business_connection_id: Optional[str] = None,
provider_token: Optional[str] = None,
subscription_period: Optional[int] = None,
max_tip_amount: Optional[int] = None,
suggested_tip_amounts: Optional[list[int]] = None,
provider_data: Optional[str] = None,
@ -96,7 +102,9 @@ class CreateInvoiceLink(TelegramMethod[str]):
payload=payload,
currency=currency,
prices=prices,
business_connection_id=business_connection_id,
provider_token=provider_token,
subscription_period=subscription_period,
max_tip_amount=max_tip_amount,
suggested_tip_amounts=suggested_tip_amounts,
provider_data=provider_data,

View file

@ -0,0 +1,46 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from .base import TelegramMethod
class EditUserStarSubscription(TelegramMethod[bool]):
"""
Allows the bot to cancel or re-enable extension of a subscription paid in Telegram Stars. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#edituserstarsubscription
"""
__returning__ = bool
__api_method__ = "editUserStarSubscription"
user_id: int
"""Identifier of the user whose subscription will be edited"""
telegram_payment_charge_id: str
"""Telegram payment identifier for the subscription"""
is_canceled: bool
"""Pass :code:`True` to cancel extension of the user subscription; the subscription must be active up to the end of the current subscription period. Pass :code:`False` to allow the user to re-enable a subscription that was previously canceled by the bot."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
user_id: int,
telegram_payment_charge_id: str,
is_canceled: bool,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(
user_id=user_id,
telegram_payment_charge_id=telegram_payment_charge_id,
is_canceled=is_canceled,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,15 @@
from __future__ import annotations
from ..types.gifts import Gifts
from .base import TelegramMethod
class GetAvailableGifts(TelegramMethod[Gifts]):
"""
Returns the list of gifts that can be sent by the bot to users. Requires no parameters. Returns a :class:`aiogram.types.gifts.Gifts` object.
Source: https://core.telegram.org/bots/api#getavailablegifts
"""
__returning__ = Gifts
__api_method__ = "getAvailableGifts"

View file

@ -0,0 +1,129 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional, Union
from ..types.prepared_inline_message import PreparedInlineMessage
from .base import TelegramMethod
if TYPE_CHECKING:
from ..types.inline_query_result_article import InlineQueryResultArticle
from ..types.inline_query_result_audio import InlineQueryResultAudio
from ..types.inline_query_result_cached_audio import InlineQueryResultCachedAudio
from ..types.inline_query_result_cached_document import (
InlineQueryResultCachedDocument,
)
from ..types.inline_query_result_cached_gif import InlineQueryResultCachedGif
from ..types.inline_query_result_cached_mpeg4_gif import (
InlineQueryResultCachedMpeg4Gif,
)
from ..types.inline_query_result_cached_photo import InlineQueryResultCachedPhoto
from ..types.inline_query_result_cached_sticker import (
InlineQueryResultCachedSticker,
)
from ..types.inline_query_result_cached_video import InlineQueryResultCachedVideo
from ..types.inline_query_result_cached_voice import InlineQueryResultCachedVoice
from ..types.inline_query_result_contact import InlineQueryResultContact
from ..types.inline_query_result_document import InlineQueryResultDocument
from ..types.inline_query_result_game import InlineQueryResultGame
from ..types.inline_query_result_gif import InlineQueryResultGif
from ..types.inline_query_result_location import InlineQueryResultLocation
from ..types.inline_query_result_mpeg4_gif import InlineQueryResultMpeg4Gif
from ..types.inline_query_result_photo import InlineQueryResultPhoto
from ..types.inline_query_result_venue import InlineQueryResultVenue
from ..types.inline_query_result_video import InlineQueryResultVideo
from ..types.inline_query_result_voice import InlineQueryResultVoice
class SavePreparedInlineMessage(TelegramMethod[PreparedInlineMessage]):
"""
Stores a message that can be sent by a user of a Mini App. Returns a :class:`aiogram.types.prepared_inline_message.PreparedInlineMessage` object.
Source: https://core.telegram.org/bots/api#savepreparedinlinemessage
"""
__returning__ = PreparedInlineMessage
__api_method__ = "savePreparedInlineMessage"
user_id: int
"""Unique identifier of the target user that can use the prepared message"""
result: Union[
InlineQueryResultCachedAudio,
InlineQueryResultCachedDocument,
InlineQueryResultCachedGif,
InlineQueryResultCachedMpeg4Gif,
InlineQueryResultCachedPhoto,
InlineQueryResultCachedSticker,
InlineQueryResultCachedVideo,
InlineQueryResultCachedVoice,
InlineQueryResultArticle,
InlineQueryResultAudio,
InlineQueryResultContact,
InlineQueryResultGame,
InlineQueryResultDocument,
InlineQueryResultGif,
InlineQueryResultLocation,
InlineQueryResultMpeg4Gif,
InlineQueryResultPhoto,
InlineQueryResultVenue,
InlineQueryResultVideo,
InlineQueryResultVoice,
]
"""A JSON-serialized object describing the message to be sent"""
allow_user_chats: Optional[bool] = None
"""Pass :code:`True` if the message can be sent to private chats with users"""
allow_bot_chats: Optional[bool] = None
"""Pass :code:`True` if the message can be sent to private chats with bots"""
allow_group_chats: Optional[bool] = None
"""Pass :code:`True` if the message can be sent to group and supergroup chats"""
allow_channel_chats: Optional[bool] = None
"""Pass :code:`True` if the message can be sent to channel chats"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
user_id: int,
result: Union[
InlineQueryResultCachedAudio,
InlineQueryResultCachedDocument,
InlineQueryResultCachedGif,
InlineQueryResultCachedMpeg4Gif,
InlineQueryResultCachedPhoto,
InlineQueryResultCachedSticker,
InlineQueryResultCachedVideo,
InlineQueryResultCachedVoice,
InlineQueryResultArticle,
InlineQueryResultAudio,
InlineQueryResultContact,
InlineQueryResultGame,
InlineQueryResultDocument,
InlineQueryResultGif,
InlineQueryResultLocation,
InlineQueryResultMpeg4Gif,
InlineQueryResultPhoto,
InlineQueryResultVenue,
InlineQueryResultVideo,
InlineQueryResultVoice,
],
allow_user_chats: Optional[bool] = None,
allow_bot_chats: Optional[bool] = None,
allow_group_chats: Optional[bool] = None,
allow_channel_chats: Optional[bool] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(
user_id=user_id,
result=result,
allow_user_chats=allow_user_chats,
allow_bot_chats=allow_bot_chats,
allow_group_chats=allow_group_chats,
allow_channel_chats=allow_channel_chats,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,57 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramMethod
if TYPE_CHECKING:
from ..types import MessageEntity
class SendGift(TelegramMethod[bool]):
"""
Sends a gift to the given user. The gift can't be converted to Telegram Stars by the user. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#sendgift
"""
__returning__ = bool
__api_method__ = "sendGift"
user_id: int
"""Unique identifier of the target user that will receive the gift"""
gift_id: str
"""Identifier of the gift"""
text: Optional[str] = None
"""Text that will be shown along with the gift; 0-255 characters"""
text_parse_mode: Optional[str] = None
"""Mode for parsing entities in the text. See `formatting options <https://core.telegram.org/bots/api#formatting-options>`_ for more details. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored."""
text_entities: Optional[list[MessageEntity]] = None
"""A JSON-serialized list of special entities that appear in the gift text. It can be specified instead of *text_parse_mode*. Entities other than 'bold', 'italic', 'underline', 'strikethrough', 'spoiler', and 'custom_emoji' are ignored."""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
user_id: int,
gift_id: str,
text: Optional[str] = None,
text_parse_mode: Optional[str] = None,
text_entities: Optional[list[MessageEntity]] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(
user_id=user_id,
gift_id=gift_id,
text=text,
text_parse_mode=text_parse_mode,
text_entities=text_entities,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,46 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramMethod
class SetUserEmojiStatus(TelegramMethod[bool]):
"""
Changes the emoji status for a given user that previously allowed the bot to manage their emoji status via the Mini App method `requestEmojiStatusAccess <https://core.telegram.org/bots/webapps#initializing-mini-apps>`_. Returns :code:`True` on success.
Source: https://core.telegram.org/bots/api#setuseremojistatus
"""
__returning__ = bool
__api_method__ = "setUserEmojiStatus"
user_id: int
"""Unique identifier of the target user"""
emoji_status_custom_emoji_id: Optional[str] = None
"""Custom emoji identifier of the emoji status to set. Pass an empty string to remove the status."""
emoji_status_expiration_date: Optional[int] = None
"""Expiration date of the emoji status, if any"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
user_id: int,
emoji_status_custom_emoji_id: Optional[str] = None,
emoji_status_expiration_date: Optional[int] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(
user_id=user_id,
emoji_status_custom_emoji_id=emoji_status_custom_emoji_id,
emoji_status_expiration_date=emoji_status_expiration_date,
**__pydantic_kwargs,
)

View file

@ -83,6 +83,8 @@ from .game import Game
from .game_high_score import GameHighScore
from .general_forum_topic_hidden import GeneralForumTopicHidden
from .general_forum_topic_unhidden import GeneralForumTopicUnhidden
from .gift import Gift
from .gifts import Gifts
from .giveaway import Giveaway
from .giveaway_completed import GiveawayCompleted
from .giveaway_created import GiveawayCreated
@ -184,6 +186,7 @@ from .poll import Poll
from .poll_answer import PollAnswer
from .poll_option import PollOption
from .pre_checkout_query import PreCheckoutQuery
from .prepared_inline_message import PreparedInlineMessage
from .proximity_alert_triggered import ProximityAlertTriggered
from .reaction_count import ReactionCount
from .reaction_type import ReactionType
@ -321,6 +324,8 @@ __all__ = (
"GameHighScore",
"GeneralForumTopicHidden",
"GeneralForumTopicUnhidden",
"Gift",
"Gifts",
"Giveaway",
"GiveawayCompleted",
"GiveawayCreated",
@ -420,6 +425,7 @@ __all__ = (
"PollAnswer",
"PollOption",
"PreCheckoutQuery",
"PreparedInlineMessage",
"ProximityAlertTriggered",
"ReactionCount",
"ReactionType",

54
aiogram/types/gift.py Normal file
View file

@ -0,0 +1,54 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Optional
from .base import TelegramObject
if TYPE_CHECKING:
from .sticker import Sticker
class Gift(TelegramObject):
"""
This object represents a gift that can be sent by the bot.
Source: https://core.telegram.org/bots/api#gift
"""
id: str
"""Unique identifier of the gift"""
sticker: Sticker
"""The sticker that represents the gift"""
star_count: int
"""The number of Telegram Stars that must be paid to send the sticker"""
total_count: Optional[int] = None
"""*Optional*. The total number of the gifts of this type that can be sent; for limited gifts only"""
remaining_count: Optional[int] = None
"""*Optional*. The number of remaining gifts of this type that can be sent; for limited gifts only"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__,
*,
id: str,
sticker: Sticker,
star_count: int,
total_count: Optional[int] = None,
remaining_count: Optional[int] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(
id=id,
sticker=sticker,
star_count=star_count,
total_count=total_count,
remaining_count=remaining_count,
**__pydantic_kwargs,
)

30
aiogram/types/gifts.py Normal file
View file

@ -0,0 +1,30 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from .base import TelegramObject
if TYPE_CHECKING:
from .gift import Gift
class Gifts(TelegramObject):
"""
This object represent a list of gifts.
Source: https://core.telegram.org/bots/api#gifts
"""
gifts: list[Gift]
"""The list of gifts"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(__pydantic__self__, *, gifts: list[Gift], **__pydantic_kwargs: Any) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(gifts=gifts, **__pydantic_kwargs)

View file

@ -0,0 +1,31 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any
from .base import TelegramObject
class PreparedInlineMessage(TelegramObject):
"""
Describes an inline message to be sent by a user of a Mini App.
Source: https://core.telegram.org/bots/api#preparedinlinemessage
"""
id: str
"""Unique identifier of the prepared message"""
expiration_date: int
"""Expiration date of the prepared message, in Unix time. Expired prepared messages can no longer be used"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
# This section was auto-generated via `butcher`
def __init__(
__pydantic__self__, *, id: str, expiration_date: int, **__pydantic_kwargs: Any
) -> None:
# DO NOT EDIT MANUALLY!!!
# This method was auto-generated via `butcher`
# Is needed only for type checking and IDE support without any additional plugins
super().__init__(id=id, expiration_date=expiration_date, **__pydantic_kwargs)

View file

@ -25,6 +25,12 @@ class SuccessfulPayment(TelegramObject):
"""Telegram payment identifier"""
provider_payment_charge_id: str
"""Provider payment identifier"""
subscription_expiration_date: Optional[int] = None
"""*Optional*. Expiration date of the subscription, in Unix time; for recurring payments only"""
is_recurring: Optional[bool] = None
"""*Optional*. True, if the payment is a recurring payment for a subscription"""
is_first_recurring: Optional[bool] = None
"""*Optional*. True, if the payment is the first payment for a subscription"""
shipping_option_id: Optional[str] = None
"""*Optional*. Identifier of the shipping option chosen by the user"""
order_info: Optional[OrderInfo] = None
@ -42,6 +48,9 @@ class SuccessfulPayment(TelegramObject):
invoice_payload: str,
telegram_payment_charge_id: str,
provider_payment_charge_id: str,
subscription_expiration_date: Optional[int] = None,
is_recurring: Optional[bool] = None,
is_first_recurring: Optional[bool] = None,
shipping_option_id: Optional[str] = None,
order_info: Optional[OrderInfo] = None,
**__pydantic_kwargs: Any,
@ -56,6 +65,9 @@ class SuccessfulPayment(TelegramObject):
invoice_payload=invoice_payload,
telegram_payment_charge_id=telegram_payment_charge_id,
provider_payment_charge_id=provider_payment_charge_id,
subscription_expiration_date=subscription_expiration_date,
is_recurring=is_recurring,
is_first_recurring=is_first_recurring,
shipping_option_id=shipping_option_id,
order_info=order_info,
**__pydantic_kwargs,

View file

@ -25,10 +25,14 @@ class TransactionPartnerUser(TransactionPartner):
"""Information about the user"""
invoice_payload: Optional[str] = None
"""*Optional*. Bot-specified invoice payload"""
subscription_period: Optional[int] = None
"""*Optional*. The duration of the paid subscription"""
paid_media: Optional[list[Union[PaidMediaPreview, PaidMediaPhoto, PaidMediaVideo]]] = None
"""*Optional*. Information about the paid media bought by the user"""
paid_media_payload: Optional[str] = None
"""*Optional*. Bot-specified paid media payload"""
gift: Optional[str] = None
"""*Optional*. The gift sent to the user by the bot"""
if TYPE_CHECKING:
# DO NOT EDIT MANUALLY!!!
@ -40,10 +44,12 @@ class TransactionPartnerUser(TransactionPartner):
type: Literal[TransactionPartnerType.USER] = TransactionPartnerType.USER,
user: User,
invoice_payload: Optional[str] = None,
subscription_period: Optional[int] = None,
paid_media: Optional[
list[Union[PaidMediaPreview, PaidMediaPhoto, PaidMediaVideo]]
] = None,
paid_media_payload: Optional[str] = None,
gift: Optional[str] = None,
**__pydantic_kwargs: Any,
) -> None:
# DO NOT EDIT MANUALLY!!!
@ -54,7 +60,9 @@ class TransactionPartnerUser(TransactionPartner):
type=type,
user=user,
invoice_payload=invoice_payload,
subscription_period=subscription_period,
paid_media=paid_media,
paid_media_payload=paid_media_payload,
gift=gift,
**__pydantic_kwargs,
)

View file

@ -0,0 +1,45 @@
########################
editUserStarSubscription
########################
Returns: :obj:`bool`
.. automodule:: aiogram.methods.edit_user_star_subscription
:members:
:member-order: bysource
:undoc-members: True
:exclude-members: model_config,model_fields
Usage
=====
As bot method
-------------
.. code-block::
result: bool = await bot.edit_user_star_subscription(...)
Method as object
----------------
Imports:
- :code:`from aiogram.methods.edit_user_star_subscription import EditUserStarSubscription`
- alias: :code:`from aiogram.methods import EditUserStarSubscription`
With specific bot
~~~~~~~~~~~~~~~~~
.. code-block:: python
result: bool = await bot(EditUserStarSubscription(...))
As reply into Webhook in handler
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: python
return EditUserStarSubscription(...)

View file

@ -0,0 +1,38 @@
#################
getAvailableGifts
#################
Returns: :obj:`Gifts`
.. automodule:: aiogram.methods.get_available_gifts
:members:
:member-order: bysource
:undoc-members: True
:exclude-members: model_config,model_fields
Usage
=====
As bot method
-------------
.. code-block::
result: Gifts = await bot.get_available_gifts(...)
Method as object
----------------
Imports:
- :code:`from aiogram.methods.get_available_gifts import GetAvailableGifts`
- alias: :code:`from aiogram.methods import GetAvailableGifts`
With specific bot
~~~~~~~~~~~~~~~~~
.. code-block:: python
result: Gifts = await bot(GetAvailableGifts(...))

View file

@ -15,9 +15,11 @@ Stickers
create_new_sticker_set
delete_sticker_from_set
delete_sticker_set
get_available_gifts
get_custom_emoji_stickers
get_sticker_set
replace_sticker_in_set
send_gift
send_sticker
set_custom_emoji_sticker_set_thumbnail
set_sticker_emoji_list
@ -112,6 +114,7 @@ Available methods
set_my_description
set_my_name
set_my_short_description
set_user_emoji_status
unban_chat_member
unban_chat_sender_chat
unhide_general_forum_topic
@ -144,6 +147,7 @@ Inline mode
answer_inline_query
answer_web_app_query
save_prepared_inline_message
Games
=====
@ -164,6 +168,7 @@ Payments
answer_pre_checkout_query
answer_shipping_query
create_invoice_link
edit_user_star_subscription
get_star_transactions
refund_star_payment
send_invoice

View file

@ -0,0 +1,45 @@
#########################
savePreparedInlineMessage
#########################
Returns: :obj:`PreparedInlineMessage`
.. automodule:: aiogram.methods.save_prepared_inline_message
:members:
:member-order: bysource
:undoc-members: True
:exclude-members: model_config,model_fields
Usage
=====
As bot method
-------------
.. code-block::
result: PreparedInlineMessage = await bot.save_prepared_inline_message(...)
Method as object
----------------
Imports:
- :code:`from aiogram.methods.save_prepared_inline_message import SavePreparedInlineMessage`
- alias: :code:`from aiogram.methods import SavePreparedInlineMessage`
With specific bot
~~~~~~~~~~~~~~~~~
.. code-block:: python
result: PreparedInlineMessage = await bot(SavePreparedInlineMessage(...))
As reply into Webhook in handler
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: python
return SavePreparedInlineMessage(...)

View file

@ -0,0 +1,45 @@
########
sendGift
########
Returns: :obj:`bool`
.. automodule:: aiogram.methods.send_gift
:members:
:member-order: bysource
:undoc-members: True
:exclude-members: model_config,model_fields
Usage
=====
As bot method
-------------
.. code-block::
result: bool = await bot.send_gift(...)
Method as object
----------------
Imports:
- :code:`from aiogram.methods.send_gift import SendGift`
- alias: :code:`from aiogram.methods import SendGift`
With specific bot
~~~~~~~~~~~~~~~~~
.. code-block:: python
result: bool = await bot(SendGift(...))
As reply into Webhook in handler
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: python
return SendGift(...)

View file

@ -0,0 +1,45 @@
##################
setUserEmojiStatus
##################
Returns: :obj:`bool`
.. automodule:: aiogram.methods.set_user_emoji_status
:members:
:member-order: bysource
:undoc-members: True
:exclude-members: model_config,model_fields
Usage
=====
As bot method
-------------
.. code-block::
result: bool = await bot.set_user_emoji_status(...)
Method as object
----------------
Imports:
- :code:`from aiogram.methods.set_user_emoji_status import SetUserEmojiStatus`
- alias: :code:`from aiogram.methods import SetUserEmojiStatus`
With specific bot
~~~~~~~~~~~~~~~~~
.. code-block:: python
result: bool = await bot(SetUserEmojiStatus(...))
As reply into Webhook in handler
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.. code-block:: python
return SetUserEmojiStatus(...)

10
docs/api/types/gift.rst Normal file
View file

@ -0,0 +1,10 @@
####
Gift
####
.. automodule:: aiogram.types.gift
:members:
:member-order: bysource
:undoc-members: True
:exclude-members: model_config,model_fields

10
docs/api/types/gifts.rst Normal file
View file

@ -0,0 +1,10 @@
#####
Gifts
#####
.. automodule:: aiogram.types.gifts
:members:
:member-order: bysource
:undoc-members: True
:exclude-members: model_config,model_fields

View file

@ -200,6 +200,7 @@ Inline mode
input_message_content
input_text_message_content
input_venue_message_content
prepared_inline_message
sent_web_app_message
Stickers
@ -208,6 +209,8 @@ Stickers
.. toctree::
:maxdepth: 1
gift
gifts
input_sticker
mask_position
sticker

View file

@ -0,0 +1,10 @@
#####################
PreparedInlineMessage
#####################
.. automodule:: aiogram.types.prepared_inline_message
:members:
:member-order: bysource
:undoc-members: True
:exclude-members: model_config,model_fields