ng-bot-api 0.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (193) hide show
  1. ng_bot_api/__init__.py +56 -0
  2. ng_bot_api/api_version.py +2 -0
  3. ng_bot_api/async_bot.py +97 -0
  4. ng_bot_api/core/__init__.py +31 -0
  5. ng_bot_api/core/base.py +36 -0
  6. ng_bot_api/core/caller.py +17 -0
  7. ng_bot_api/core/decoding.py +85 -0
  8. ng_bot_api/core/encoding.py +42 -0
  9. ng_bot_api/core/errors.py +75 -0
  10. ng_bot_api/core/input_file.py +56 -0
  11. ng_bot_api/core/polling.py +39 -0
  12. ng_bot_api/core/registry.py +72 -0
  13. ng_bot_api/core/request.py +67 -0
  14. ng_bot_api/core/typespec.py +57 -0
  15. ng_bot_api/dispatcher/__init__.py +17 -0
  16. ng_bot_api/dispatcher/dispatcher.py +95 -0
  17. ng_bot_api/dispatcher/filter_base.py +78 -0
  18. ng_bot_api/dispatcher/filters.py +124 -0
  19. ng_bot_api/dispatcher/handler.py +34 -0
  20. ng_bot_api/dispatcher/router.py +69 -0
  21. ng_bot_api/methods/__init__.py +115 -0
  22. ng_bot_api/methods/async_01.py +99 -0
  23. ng_bot_api/methods/async_02.py +114 -0
  24. ng_bot_api/methods/async_03.py +85 -0
  25. ng_bot_api/methods/async_04.py +110 -0
  26. ng_bot_api/methods/async_05.py +114 -0
  27. ng_bot_api/methods/async_06.py +74 -0
  28. ng_bot_api/methods/async_07.py +114 -0
  29. ng_bot_api/methods/async_08.py +106 -0
  30. ng_bot_api/methods/async_09.py +97 -0
  31. ng_bot_api/methods/async_10.py +92 -0
  32. ng_bot_api/methods/async_11.py +107 -0
  33. ng_bot_api/methods/async_12.py +119 -0
  34. ng_bot_api/methods/async_13.py +119 -0
  35. ng_bot_api/methods/async_14.py +113 -0
  36. ng_bot_api/methods/async_15.py +117 -0
  37. ng_bot_api/methods/async_16.py +115 -0
  38. ng_bot_api/methods/async_17.py +121 -0
  39. ng_bot_api/methods/async_18.py +118 -0
  40. ng_bot_api/methods/async_19.py +128 -0
  41. ng_bot_api/methods/async_20.py +115 -0
  42. ng_bot_api/methods/async_21.py +127 -0
  43. ng_bot_api/methods/async_22.py +110 -0
  44. ng_bot_api/methods/async_23.py +116 -0
  45. ng_bot_api/methods/async_24.py +118 -0
  46. ng_bot_api/methods/async_25.py +109 -0
  47. ng_bot_api/methods/async_26.py +124 -0
  48. ng_bot_api/methods/async_27.py +119 -0
  49. ng_bot_api/methods/async_28.py +119 -0
  50. ng_bot_api/methods/async_29.py +108 -0
  51. ng_bot_api/methods/async_30.py +115 -0
  52. ng_bot_api/methods/async_31.py +112 -0
  53. ng_bot_api/methods/async_32.py +126 -0
  54. ng_bot_api/methods/async_33.py +105 -0
  55. ng_bot_api/methods/async_34.py +117 -0
  56. ng_bot_api/methods/async_35.py +122 -0
  57. ng_bot_api/methods/async_36.py +121 -0
  58. ng_bot_api/methods/async_37.py +126 -0
  59. ng_bot_api/methods/async_38.py +112 -0
  60. ng_bot_api/methods/async_39.py +84 -0
  61. ng_bot_api/methods/async_40.py +125 -0
  62. ng_bot_api/methods/async_41.py +115 -0
  63. ng_bot_api/methods/async_42.py +30 -0
  64. ng_bot_api/methods/sync_01.py +99 -0
  65. ng_bot_api/methods/sync_02.py +114 -0
  66. ng_bot_api/methods/sync_03.py +85 -0
  67. ng_bot_api/methods/sync_04.py +110 -0
  68. ng_bot_api/methods/sync_05.py +114 -0
  69. ng_bot_api/methods/sync_06.py +74 -0
  70. ng_bot_api/methods/sync_07.py +114 -0
  71. ng_bot_api/methods/sync_08.py +106 -0
  72. ng_bot_api/methods/sync_09.py +97 -0
  73. ng_bot_api/methods/sync_10.py +92 -0
  74. ng_bot_api/methods/sync_11.py +107 -0
  75. ng_bot_api/methods/sync_12.py +119 -0
  76. ng_bot_api/methods/sync_13.py +119 -0
  77. ng_bot_api/methods/sync_14.py +113 -0
  78. ng_bot_api/methods/sync_15.py +117 -0
  79. ng_bot_api/methods/sync_16.py +115 -0
  80. ng_bot_api/methods/sync_17.py +121 -0
  81. ng_bot_api/methods/sync_18.py +118 -0
  82. ng_bot_api/methods/sync_19.py +128 -0
  83. ng_bot_api/methods/sync_20.py +115 -0
  84. ng_bot_api/methods/sync_21.py +127 -0
  85. ng_bot_api/methods/sync_22.py +110 -0
  86. ng_bot_api/methods/sync_23.py +116 -0
  87. ng_bot_api/methods/sync_24.py +118 -0
  88. ng_bot_api/methods/sync_25.py +109 -0
  89. ng_bot_api/methods/sync_26.py +124 -0
  90. ng_bot_api/methods/sync_27.py +119 -0
  91. ng_bot_api/methods/sync_28.py +119 -0
  92. ng_bot_api/methods/sync_29.py +108 -0
  93. ng_bot_api/methods/sync_30.py +115 -0
  94. ng_bot_api/methods/sync_31.py +112 -0
  95. ng_bot_api/methods/sync_32.py +126 -0
  96. ng_bot_api/methods/sync_33.py +105 -0
  97. ng_bot_api/methods/sync_34.py +117 -0
  98. ng_bot_api/methods/sync_35.py +122 -0
  99. ng_bot_api/methods/sync_36.py +121 -0
  100. ng_bot_api/methods/sync_37.py +126 -0
  101. ng_bot_api/methods/sync_38.py +112 -0
  102. ng_bot_api/methods/sync_39.py +84 -0
  103. ng_bot_api/methods/sync_40.py +125 -0
  104. ng_bot_api/methods/sync_41.py +115 -0
  105. ng_bot_api/methods/sync_42.py +30 -0
  106. ng_bot_api/py.typed +0 -0
  107. ng_bot_api/sync_bot.py +95 -0
  108. ng_bot_api/types/__init__.py +82 -0
  109. ng_bot_api/types/available_types_01.py +102 -0
  110. ng_bot_api/types/available_types_02.py +141 -0
  111. ng_bot_api/types/available_types_03.py +311 -0
  112. ng_bot_api/types/available_types_04.py +84 -0
  113. ng_bot_api/types/available_types_05.py +134 -0
  114. ng_bot_api/types/available_types_06.py +126 -0
  115. ng_bot_api/types/available_types_07.py +119 -0
  116. ng_bot_api/types/available_types_08.py +120 -0
  117. ng_bot_api/types/available_types_09.py +115 -0
  118. ng_bot_api/types/available_types_10.py +109 -0
  119. ng_bot_api/types/available_types_11.py +121 -0
  120. ng_bot_api/types/available_types_12.py +120 -0
  121. ng_bot_api/types/available_types_13.py +128 -0
  122. ng_bot_api/types/available_types_14.py +124 -0
  123. ng_bot_api/types/available_types_15.py +129 -0
  124. ng_bot_api/types/available_types_16.py +121 -0
  125. ng_bot_api/types/available_types_17.py +124 -0
  126. ng_bot_api/types/available_types_18.py +128 -0
  127. ng_bot_api/types/available_types_19.py +115 -0
  128. ng_bot_api/types/available_types_20.py +123 -0
  129. ng_bot_api/types/available_types_21.py +101 -0
  130. ng_bot_api/types/available_types_22.py +121 -0
  131. ng_bot_api/types/available_types_23.py +128 -0
  132. ng_bot_api/types/available_types_24.py +107 -0
  133. ng_bot_api/types/available_types_25.py +100 -0
  134. ng_bot_api/types/available_types_26.py +81 -0
  135. ng_bot_api/types/available_types_27.py +114 -0
  136. ng_bot_api/types/available_types_28.py +125 -0
  137. ng_bot_api/types/available_types_29.py +118 -0
  138. ng_bot_api/types/available_types_30.py +113 -0
  139. ng_bot_api/types/available_types_31.py +120 -0
  140. ng_bot_api/types/available_types_32.py +124 -0
  141. ng_bot_api/types/available_types_33.py +125 -0
  142. ng_bot_api/types/available_types_34.py +113 -0
  143. ng_bot_api/types/available_types_35.py +125 -0
  144. ng_bot_api/types/available_types_36.py +119 -0
  145. ng_bot_api/types/available_types_37.py +126 -0
  146. ng_bot_api/types/available_types_38.py +118 -0
  147. ng_bot_api/types/available_types_39.py +121 -0
  148. ng_bot_api/types/available_types_40.py +121 -0
  149. ng_bot_api/types/available_types_41.py +116 -0
  150. ng_bot_api/types/available_types_42.py +112 -0
  151. ng_bot_api/types/available_types_43.py +110 -0
  152. ng_bot_api/types/available_types_44.py +30 -0
  153. ng_bot_api/types/games_01.py +57 -0
  154. ng_bot_api/types/getting_updates_01.py +123 -0
  155. ng_bot_api/types/inline_mode_01.py +124 -0
  156. ng_bot_api/types/inline_mode_02.py +91 -0
  157. ng_bot_api/types/inline_mode_03.py +116 -0
  158. ng_bot_api/types/inline_mode_04.py +126 -0
  159. ng_bot_api/types/inline_mode_05.py +124 -0
  160. ng_bot_api/types/inline_mode_06.py +124 -0
  161. ng_bot_api/types/inline_mode_07.py +119 -0
  162. ng_bot_api/types/inline_mode_08.py +104 -0
  163. ng_bot_api/types/inline_mode_09.py +84 -0
  164. ng_bot_api/types/payments_01.py +124 -0
  165. ng_bot_api/types/payments_02.py +124 -0
  166. ng_bot_api/types/payments_03.py +119 -0
  167. ng_bot_api/types/payments_04.py +70 -0
  168. ng_bot_api/types/rich_messages_01.py +126 -0
  169. ng_bot_api/types/rich_messages_02.py +125 -0
  170. ng_bot_api/types/rich_messages_03.py +115 -0
  171. ng_bot_api/types/rich_messages_04.py +116 -0
  172. ng_bot_api/types/rich_messages_05.py +128 -0
  173. ng_bot_api/types/rich_messages_06.py +125 -0
  174. ng_bot_api/types/rich_messages_07.py +114 -0
  175. ng_bot_api/types/rich_messages_08.py +118 -0
  176. ng_bot_api/types/rich_messages_09.py +124 -0
  177. ng_bot_api/types/rich_messages_10.py +125 -0
  178. ng_bot_api/types/rich_messages_11.py +122 -0
  179. ng_bot_api/types/rich_messages_12.py +122 -0
  180. ng_bot_api/types/stickers_01.py +107 -0
  181. ng_bot_api/types/telegram_passport_01.py +120 -0
  182. ng_bot_api/types/telegram_passport_02.py +113 -0
  183. ng_bot_api/types/telegram_passport_03.py +24 -0
  184. ng_bot_api/types/unions_01.py +140 -0
  185. ng_bot_api/types/unions_02.py +132 -0
  186. ng_bot_api/types/unions_03.py +134 -0
  187. ng_bot_api/types/unions_04.py +149 -0
  188. ng_bot_api/types/unions_05.py +96 -0
  189. ng_bot_api/webhook.py +78 -0
  190. ng_bot_api-0.1.0.dist-info/METADATA +179 -0
  191. ng_bot_api-0.1.0.dist-info/RECORD +193 -0
  192. ng_bot_api-0.1.0.dist-info/WHEEL +4 -0
  193. ng_bot_api-0.1.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,119 @@
1
+ from __future__ import annotations
2
+
3
+ from ..core.caller import AsyncCaller
4
+ from ..types import AcceptedGiftTypes, InputProfilePhoto, StarAmount
5
+
6
+
7
+ class AsyncMethods27(AsyncCaller):
8
+ __slots__ = ()
9
+
10
+ async def set_business_account_username(
11
+ self,
12
+ business_connection_id: str,
13
+ *,
14
+ username: str | None = None,
15
+ ) -> bool:
16
+ """Changes the username of a managed business account. Requires the can_edit_username business bot right. Returns True on success.
17
+
18
+ Args:
19
+ business_connection_id: Unique identifier of the business connection
20
+ username: The new value of the username for the business account; 0-32 characters
21
+
22
+ https://core.telegram.org/bots/api#setbusinessaccountusername
23
+ """
24
+ return await self._call('setBusinessAccountUsername', locals(), 'bool')
25
+
26
+ async def set_business_account_bio(
27
+ self,
28
+ business_connection_id: str,
29
+ *,
30
+ bio: str | None = None,
31
+ ) -> bool:
32
+ """Changes the bio of a managed business account. Requires the can_edit_bio business bot right. Returns True on success.
33
+
34
+ Args:
35
+ business_connection_id: Unique identifier of the business connection
36
+ bio: The new value of the bio for the business account; 0-140 characters
37
+
38
+ https://core.telegram.org/bots/api#setbusinessaccountbio
39
+ """
40
+ return await self._call('setBusinessAccountBio', locals(), 'bool')
41
+
42
+ async def set_business_account_profile_photo(
43
+ self,
44
+ business_connection_id: str,
45
+ photo: InputProfilePhoto,
46
+ *,
47
+ is_public: bool | None = None,
48
+ ) -> bool:
49
+ """Changes the profile photo of a managed business account. Requires the can_edit_profile_photo business bot right. Returns True on success.
50
+
51
+ Args:
52
+ business_connection_id: Unique identifier of the business connection
53
+ photo: The new profile photo to set
54
+ is_public: Pass True to set the public photo, which will be visible even if the main photo is hidden by the business account's privacy settings. An account can have only one public photo.
55
+
56
+ https://core.telegram.org/bots/api#setbusinessaccountprofilephoto
57
+ """
58
+ return await self._call('setBusinessAccountProfilePhoto', locals(), 'bool')
59
+
60
+ async def remove_business_account_profile_photo(
61
+ self,
62
+ business_connection_id: str,
63
+ *,
64
+ is_public: bool | None = None,
65
+ ) -> bool:
66
+ """Removes the current profile photo of a managed business account. Requires the can_edit_profile_photo business bot right. Returns True on success.
67
+
68
+ Args:
69
+ business_connection_id: Unique identifier of the business connection
70
+ is_public: Pass True to remove the public photo, which is visible even if the main photo is hidden by the business account's privacy settings. After the main photo is removed, the previous profile photo (if present) becomes the main photo.
71
+
72
+ https://core.telegram.org/bots/api#removebusinessaccountprofilephoto
73
+ """
74
+ return await self._call('removeBusinessAccountProfilePhoto', locals(), 'bool')
75
+
76
+ async def set_business_account_gift_settings(
77
+ self,
78
+ business_connection_id: str,
79
+ show_gift_button: bool,
80
+ accepted_gift_types: AcceptedGiftTypes,
81
+ ) -> bool:
82
+ """Changes the privacy settings pertaining to incoming gifts in a managed business account. Requires the can_change_gift_settings business bot right. Returns True on success.
83
+
84
+ Args:
85
+ business_connection_id: Unique identifier of the business connection
86
+ show_gift_button: Pass True if a button for sending a gift to the user or by the business account must always be shown in the input field
87
+ accepted_gift_types: Types of gifts accepted by the business account
88
+
89
+ https://core.telegram.org/bots/api#setbusinessaccountgiftsettings
90
+ """
91
+ return await self._call('setBusinessAccountGiftSettings', locals(), 'bool')
92
+
93
+ async def get_business_account_star_balance(
94
+ self,
95
+ business_connection_id: str,
96
+ ) -> StarAmount:
97
+ """Returns the amount of Telegram Stars owned by a managed business account. Requires the can_view_gifts_and_stars business bot right. Returns StarAmount on success.
98
+
99
+ Args:
100
+ business_connection_id: Unique identifier of the business connection
101
+
102
+ https://core.telegram.org/bots/api#getbusinessaccountstarbalance
103
+ """
104
+ return await self._call('getBusinessAccountStarBalance', locals(), 'StarAmount')
105
+
106
+ async def transfer_business_account_stars(
107
+ self,
108
+ business_connection_id: str,
109
+ star_count: int,
110
+ ) -> bool:
111
+ """Transfers Telegram Stars from the business account balance to the bot's balance. Requires the can_transfer_stars business bot right. Returns True on success.
112
+
113
+ Args:
114
+ business_connection_id: Unique identifier of the business connection
115
+ star_count: Number of Telegram Stars to transfer; 1-10000
116
+
117
+ https://core.telegram.org/bots/api#transferbusinessaccountstars
118
+ """
119
+ return await self._call('transferBusinessAccountStars', locals(), 'bool')
@@ -0,0 +1,119 @@
1
+ from __future__ import annotations
2
+
3
+ from ..core.caller import AsyncCaller
4
+ from ..types import OwnedGifts, UniqueGift
5
+
6
+
7
+ class AsyncMethods28(AsyncCaller):
8
+ __slots__ = ()
9
+
10
+ async def get_business_account_gifts(
11
+ self,
12
+ business_connection_id: str,
13
+ *,
14
+ exclude_unsaved: bool | None = None,
15
+ exclude_saved: bool | None = None,
16
+ exclude_unlimited: bool | None = None,
17
+ exclude_limited_upgradable: bool | None = None,
18
+ exclude_limited_non_upgradable: bool | None = None,
19
+ exclude_unique: bool | None = None,
20
+ exclude_from_blockchain: bool | None = None,
21
+ sort_by_price: bool | None = None,
22
+ offset: str | None = None,
23
+ limit: int | None = None,
24
+ ) -> OwnedGifts:
25
+ """Returns the gifts received and owned by a managed business account. Requires the can_view_gifts_and_stars business bot right. Returns OwnedGifts on success.
26
+
27
+ Args:
28
+ business_connection_id: Unique identifier of the business connection
29
+ exclude_unsaved: Pass True to exclude gifts that aren't saved to the account's profile page
30
+ exclude_saved: Pass True to exclude gifts that are saved to the account's profile page
31
+ exclude_unlimited: Pass True to exclude gifts that can be purchased an unlimited number of times
32
+ exclude_limited_upgradable: Pass True to exclude gifts that can be purchased a limited number of times and can be upgraded to unique
33
+ exclude_limited_non_upgradable: Pass True to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique
34
+ exclude_unique: Pass True to exclude unique gifts
35
+ exclude_from_blockchain: Pass True to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram
36
+ sort_by_price: Pass True to sort results by gift price instead of send date. Sorting is applied before pagination.
37
+ offset: Offset of the first entry to return as received from the previous request; use an empty string to get the first chunk of results
38
+ limit: The maximum number of gifts to be returned; 1-100. Defaults to 100.
39
+
40
+ https://core.telegram.org/bots/api#getbusinessaccountgifts
41
+ """
42
+ return await self._call('getBusinessAccountGifts', locals(), 'OwnedGifts')
43
+
44
+ async def get_user_gifts(
45
+ self,
46
+ user_id: int,
47
+ *,
48
+ exclude_unlimited: bool | None = None,
49
+ exclude_limited_upgradable: bool | None = None,
50
+ exclude_limited_non_upgradable: bool | None = None,
51
+ exclude_from_blockchain: bool | None = None,
52
+ exclude_unique: bool | None = None,
53
+ sort_by_price: bool | None = None,
54
+ offset: str | None = None,
55
+ limit: int | None = None,
56
+ ) -> OwnedGifts:
57
+ """Returns the gifts owned and hosted by a user. Returns OwnedGifts on success.
58
+
59
+ Args:
60
+ user_id: Unique identifier of the user
61
+ exclude_unlimited: Pass True to exclude gifts that can be purchased an unlimited number of times
62
+ exclude_limited_upgradable: Pass True to exclude gifts that can be purchased a limited number of times and can be upgraded to unique
63
+ exclude_limited_non_upgradable: Pass True to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique
64
+ exclude_from_blockchain: Pass True to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram
65
+ exclude_unique: Pass True to exclude unique gifts
66
+ sort_by_price: Pass True to sort results by gift price instead of send date. Sorting is applied before pagination.
67
+ offset: Offset of the first entry to return as received from the previous request; use an empty string to get the first chunk of results
68
+ limit: The maximum number of gifts to be returned; 1-100. Defaults to 100.
69
+
70
+ https://core.telegram.org/bots/api#getusergifts
71
+ """
72
+ return await self._call('getUserGifts', locals(), 'OwnedGifts')
73
+
74
+ async def get_chat_gifts(
75
+ self,
76
+ chat_id: int | str,
77
+ *,
78
+ exclude_unsaved: bool | None = None,
79
+ exclude_saved: bool | None = None,
80
+ exclude_unlimited: bool | None = None,
81
+ exclude_limited_upgradable: bool | None = None,
82
+ exclude_limited_non_upgradable: bool | None = None,
83
+ exclude_from_blockchain: bool | None = None,
84
+ exclude_unique: bool | None = None,
85
+ sort_by_price: bool | None = None,
86
+ offset: str | None = None,
87
+ limit: int | None = None,
88
+ ) -> OwnedGifts:
89
+ """Returns the gifts owned by a chat. Returns OwnedGifts on success.
90
+
91
+ Args:
92
+ chat_id: Unique identifier for the target chat or username of the target channel in the format @username
93
+ exclude_unsaved: Pass True to exclude gifts that aren't saved to the chat's profile page. Always True, unless the bot has the can_post_messages administrator right in the channel.
94
+ exclude_saved: Pass True to exclude gifts that are saved to the chat's profile page. Always False, unless the bot has the can_post_messages administrator right in the channel.
95
+ exclude_unlimited: Pass True to exclude gifts that can be purchased an unlimited number of times
96
+ exclude_limited_upgradable: Pass True to exclude gifts that can be purchased a limited number of times and can be upgraded to unique
97
+ exclude_limited_non_upgradable: Pass True to exclude gifts that can be purchased a limited number of times and can't be upgraded to unique
98
+ exclude_from_blockchain: Pass True to exclude gifts that were assigned from the TON blockchain and can't be resold or transferred in Telegram
99
+ exclude_unique: Pass True to exclude unique gifts
100
+ sort_by_price: Pass True to sort results by gift price instead of send date. Sorting is applied before pagination.
101
+ offset: Offset of the first entry to return as received from the previous request; use an empty string to get the first chunk of results
102
+ limit: The maximum number of gifts to be returned; 1-100. Defaults to 100.
103
+
104
+ https://core.telegram.org/bots/api#getchatgifts
105
+ """
106
+ return await self._call('getChatGifts', locals(), 'OwnedGifts')
107
+
108
+ async def get_unique_gift(
109
+ self,
110
+ name: str,
111
+ ) -> UniqueGift:
112
+ """Use this method to get information about a unique gift by its name. Returns a UniqueGift object on success.
113
+
114
+ Args:
115
+ name: Unique name of the gift
116
+
117
+ https://core.telegram.org/bots/api#getuniquegift
118
+ """
119
+ return await self._call('getUniqueGift', locals(), 'UniqueGift')
@@ -0,0 +1,108 @@
1
+ from __future__ import annotations
2
+
3
+ from ..core.caller import AsyncCaller
4
+ from ..types import InputStoryContent, MessageEntity, Story, StoryArea
5
+
6
+
7
+ class AsyncMethods29(AsyncCaller):
8
+ __slots__ = ()
9
+
10
+ async def convert_gift_to_stars(
11
+ self,
12
+ business_connection_id: str,
13
+ owned_gift_id: str,
14
+ ) -> bool:
15
+ """Converts a given regular gift to Telegram Stars. Requires the can_convert_gifts_to_stars business bot right. Returns True on success.
16
+
17
+ Args:
18
+ business_connection_id: Unique identifier of the business connection
19
+ owned_gift_id: Unique identifier of the regular gift that should be converted to Telegram Stars
20
+
21
+ https://core.telegram.org/bots/api#convertgifttostars
22
+ """
23
+ return await self._call('convertGiftToStars', locals(), 'bool')
24
+
25
+ async def upgrade_gift(
26
+ self,
27
+ business_connection_id: str,
28
+ owned_gift_id: str,
29
+ *,
30
+ keep_original_details: bool | None = None,
31
+ star_count: int | None = None,
32
+ ) -> bool:
33
+ """Upgrades a given regular gift to a unique gift. Requires the can_transfer_and_upgrade_gifts business bot right. Additionally requires the can_transfer_stars business bot right if the upgrade is paid. Returns True on success.
34
+
35
+ Args:
36
+ business_connection_id: Unique identifier of the business connection
37
+ owned_gift_id: Unique identifier of the regular gift that should be upgraded to a unique one
38
+ keep_original_details: Pass True to keep the original gift text, sender and receiver in the upgraded gift
39
+ star_count: The amount of Telegram Stars that will be paid for the upgrade from the business account balance. If gift.prepaid_upgrade_star_count > 0, then pass 0; otherwise, the can_transfer_stars business bot right is required and gift.upgrade_star_count must be passed.
40
+
41
+ https://core.telegram.org/bots/api#upgradegift
42
+ """
43
+ return await self._call('upgradeGift', locals(), 'bool')
44
+
45
+ async def transfer_gift(
46
+ self,
47
+ business_connection_id: str,
48
+ owned_gift_id: str,
49
+ new_owner_chat_id: int,
50
+ *,
51
+ star_count: int | None = None,
52
+ ) -> bool:
53
+ """Transfers an owned unique gift to another user. Requires the can_transfer_and_upgrade_gifts business bot right. Requires the can_transfer_stars business bot right if the transfer is paid. Returns True on success.
54
+
55
+ Args:
56
+ business_connection_id: Unique identifier of the business connection
57
+ owned_gift_id: Unique identifier of the unique gift that should be transferred
58
+ new_owner_chat_id: Unique identifier of the chat which will own the gift. The chat must have been active in the last 24 hours.
59
+ star_count: The amount of Telegram Stars that will be paid for the transfer from the business account balance. If positive, then the can_transfer_stars business bot right is required.
60
+
61
+ https://core.telegram.org/bots/api#transfergift
62
+ """
63
+ return await self._call('transferGift', locals(), 'bool')
64
+
65
+ async def delete_business_account_gift(
66
+ self,
67
+ business_connection_id: str,
68
+ owned_gift_id: str,
69
+ ) -> bool:
70
+ """Deletes a regular gift owned by a managed business account without receiving Telegram Stars for it. Requires the can_convert_gifts_to_stars business bot right. The gift can be deleted only if it isn't limited (the field total_count of the Gift is omitted) and wasn't refunded. Returns True on success.
71
+
72
+ Args:
73
+ business_connection_id: Unique identifier of the business connection
74
+ owned_gift_id: Unique identifier of the regular gift that should be deleted
75
+
76
+ https://core.telegram.org/bots/api#deletebusinessaccountgift
77
+ """
78
+ return await self._call('deleteBusinessAccountGift', locals(), 'bool')
79
+
80
+ async def post_story(
81
+ self,
82
+ business_connection_id: str,
83
+ content: InputStoryContent,
84
+ active_period: int,
85
+ *,
86
+ caption: str | None = None,
87
+ parse_mode: str | None = None,
88
+ caption_entities: list[MessageEntity] | None = None,
89
+ areas: list[StoryArea] | None = None,
90
+ post_to_chat_page: bool | None = None,
91
+ protect_content: bool | None = None,
92
+ ) -> Story:
93
+ """Posts a story on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns Story on success.
94
+
95
+ Args:
96
+ business_connection_id: Unique identifier of the business connection
97
+ content: Content of the story
98
+ active_period: Period after which the story is moved to the archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400
99
+ caption: Caption of the story, 0-2048 characters after entities parsing
100
+ parse_mode: Mode for parsing entities in the story caption. See formatting options for more details.
101
+ caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
102
+ areas: A JSON-serialized list of clickable areas to be shown on the story
103
+ post_to_chat_page: Pass True to keep the story accessible after it expires
104
+ protect_content: Pass True if the content of the story must be protected from forwarding and screenshotting
105
+
106
+ https://core.telegram.org/bots/api#poststory
107
+ """
108
+ return await self._call('postStory', locals(), 'Story')
@@ -0,0 +1,115 @@
1
+ from __future__ import annotations
2
+
3
+ from ..core.caller import AsyncCaller
4
+ from ..types import (
5
+ InlineQueryResult, InputStoryContent, MessageEntity, PreparedInlineMessage,
6
+ SentWebAppMessage, Story, StoryArea,
7
+ )
8
+
9
+
10
+ class AsyncMethods30(AsyncCaller):
11
+ __slots__ = ()
12
+
13
+ async def repost_story(
14
+ self,
15
+ business_connection_id: str,
16
+ from_chat_id: int,
17
+ from_story_id: int,
18
+ active_period: int,
19
+ *,
20
+ post_to_chat_page: bool | None = None,
21
+ protect_content: bool | None = None,
22
+ ) -> Story:
23
+ """Reposts a story on behalf of a business account from another business account. Both business accounts must be managed by the same bot, and the story on the source account must have been posted (or reposted) by the bot. Requires the can_manage_stories business bot right for both business accounts. Returns Story on success.
24
+
25
+ Args:
26
+ business_connection_id: Unique identifier of the business connection
27
+ from_chat_id: Unique identifier of the chat which posted the story that should be reposted
28
+ from_story_id: Unique identifier of the story that should be reposted
29
+ active_period: Period after which the story is moved to the archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400
30
+ post_to_chat_page: Pass True to keep the story accessible after it expires
31
+ protect_content: Pass True if the content of the story must be protected from forwarding and screenshotting
32
+
33
+ https://core.telegram.org/bots/api#repoststory
34
+ """
35
+ return await self._call('repostStory', locals(), 'Story')
36
+
37
+ async def edit_story(
38
+ self,
39
+ business_connection_id: str,
40
+ story_id: int,
41
+ content: InputStoryContent,
42
+ *,
43
+ caption: str | None = None,
44
+ parse_mode: str | None = None,
45
+ caption_entities: list[MessageEntity] | None = None,
46
+ areas: list[StoryArea] | None = None,
47
+ ) -> Story:
48
+ """Edits a story previously posted by the bot on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns Story on success.
49
+
50
+ Args:
51
+ business_connection_id: Unique identifier of the business connection
52
+ story_id: Unique identifier of the story to edit
53
+ content: Content of the story
54
+ caption: Caption of the story, 0-2048 characters after entities parsing
55
+ parse_mode: Mode for parsing entities in the story caption. See formatting options for more details.
56
+ caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
57
+ areas: A JSON-serialized list of clickable areas to be shown on the story
58
+
59
+ https://core.telegram.org/bots/api#editstory
60
+ """
61
+ return await self._call('editStory', locals(), 'Story')
62
+
63
+ async def delete_story(
64
+ self,
65
+ business_connection_id: str,
66
+ story_id: int,
67
+ ) -> bool:
68
+ """Deletes a story previously posted by the bot on behalf of a managed business account. Requires the can_manage_stories business bot right. Returns True on success.
69
+
70
+ Args:
71
+ business_connection_id: Unique identifier of the business connection
72
+ story_id: Unique identifier of the story to delete
73
+
74
+ https://core.telegram.org/bots/api#deletestory
75
+ """
76
+ return await self._call('deleteStory', locals(), 'bool')
77
+
78
+ async def answer_web_app_query(
79
+ self,
80
+ web_app_query_id: str,
81
+ result: InlineQueryResult,
82
+ ) -> SentWebAppMessage:
83
+ """Use this method to set the result of an interaction with a Web App and send a corresponding message on behalf of the user to the chat from which the query originated. On success, a SentWebAppMessage object is returned.
84
+
85
+ Args:
86
+ web_app_query_id: Unique identifier for the query to be answered
87
+ result: A JSON-serialized object describing the message to be sent
88
+
89
+ https://core.telegram.org/bots/api#answerwebappquery
90
+ """
91
+ return await self._call('answerWebAppQuery', locals(), 'SentWebAppMessage')
92
+
93
+ async def save_prepared_inline_message(
94
+ self,
95
+ user_id: int,
96
+ result: InlineQueryResult,
97
+ *,
98
+ allow_user_chats: bool | None = None,
99
+ allow_bot_chats: bool | None = None,
100
+ allow_group_chats: bool | None = None,
101
+ allow_channel_chats: bool | None = None,
102
+ ) -> PreparedInlineMessage:
103
+ """Stores a message that can be sent by a user of a Mini App. Returns a PreparedInlineMessage object.
104
+
105
+ Args:
106
+ user_id: Unique identifier of the target user that can use the prepared message
107
+ result: A JSON-serialized object describing the message to be sent
108
+ allow_user_chats: Pass True if the message can be sent to private chats with users
109
+ allow_bot_chats: Pass True if the message can be sent to private chats with bots
110
+ allow_group_chats: Pass True if the message can be sent to group and supergroup chats
111
+ allow_channel_chats: Pass True if the message can be sent to channel chats
112
+
113
+ https://core.telegram.org/bots/api#savepreparedinlinemessage
114
+ """
115
+ return await self._call('savePreparedInlineMessage', locals(), 'PreparedInlineMessage')
@@ -0,0 +1,112 @@
1
+ from __future__ import annotations
2
+
3
+ from ..core.caller import AsyncCaller
4
+ from ..types import (
5
+ InlineKeyboardMarkup, InputMedia, InputRichMessage, KeyboardButton, LinkPreviewOptions,
6
+ Message, MessageEntity, PreparedKeyboardButton,
7
+ )
8
+
9
+
10
+ class AsyncMethods31(AsyncCaller):
11
+ __slots__ = ()
12
+
13
+ async def save_prepared_keyboard_button(
14
+ self,
15
+ user_id: int,
16
+ button: KeyboardButton,
17
+ ) -> PreparedKeyboardButton:
18
+ """Stores a keyboard button that can be used by a user within a Mini App. Returns a PreparedKeyboardButton object.
19
+
20
+ Args:
21
+ user_id: Unique identifier of the target user that can use the button
22
+ button: A JSON-serialized object describing the button to be saved. The button must be of the type request_users, request_chat, or request_managed_bot.
23
+
24
+ https://core.telegram.org/bots/api#savepreparedkeyboardbutton
25
+ """
26
+ return await self._call('savePreparedKeyboardButton', locals(), 'PreparedKeyboardButton')
27
+
28
+ async def edit_message_text(
29
+ self,
30
+ *,
31
+ business_connection_id: str | None = None,
32
+ chat_id: int | str | None = None,
33
+ message_id: int | None = None,
34
+ inline_message_id: str | None = None,
35
+ text: str | None = None,
36
+ parse_mode: str | None = None,
37
+ entities: list[MessageEntity] | None = None,
38
+ link_preview_options: LinkPreviewOptions | None = None,
39
+ rich_message: InputRichMessage | None = None,
40
+ reply_markup: InlineKeyboardMarkup | None = None,
41
+ ) -> Message | bool:
42
+ """Use this method to edit text, rich and game messages. On success, if the edited message is not an inline message, the edited Message is returned; otherwise, True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.
43
+
44
+ Args:
45
+ business_connection_id: Unique identifier of the business connection on behalf of which the message to be edited was sent
46
+ chat_id: Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target bot, supergroup, or channel in the format @username.
47
+ message_id: Required if inline_message_id is not specified. Identifier of the message to edit.
48
+ inline_message_id: Required if chat_id and message_id are not specified. Identifier of the inline message.
49
+ text: New text of the message, 1-4096 characters after entity parsing; required if rich_message isn't specified
50
+ parse_mode: Mode for parsing entities in the message text. See formatting options for more details.
51
+ entities: A JSON-serialized list of special entities that appear in message text, which can be specified instead of parse_mode
52
+ link_preview_options: Link preview generation options for the message
53
+ rich_message: New rich content of the message; required if text isn't specified. Direct upload of new files and explicit upload of files by a URL aren't supported when an inline message is edited.
54
+ reply_markup: A JSON-serialized object for an inline keyboard
55
+
56
+ https://core.telegram.org/bots/api#editmessagetext
57
+ """
58
+ return await self._call('editMessageText', locals(), 'Message|bool')
59
+
60
+ async def edit_message_caption(
61
+ self,
62
+ *,
63
+ business_connection_id: str | None = None,
64
+ chat_id: int | str | None = None,
65
+ message_id: int | None = None,
66
+ inline_message_id: str | None = None,
67
+ caption: str | None = None,
68
+ parse_mode: str | None = None,
69
+ caption_entities: list[MessageEntity] | None = None,
70
+ show_caption_above_media: bool | None = None,
71
+ reply_markup: InlineKeyboardMarkup | None = None,
72
+ ) -> Message | bool:
73
+ """Use this method to edit captions of messages. On success, if the edited message is not an inline message, the edited Message is returned; otherwise, True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.
74
+
75
+ Args:
76
+ business_connection_id: Unique identifier of the business connection on behalf of which the message to be edited was sent
77
+ chat_id: Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target bot, supergroup, or channel in the format @username.
78
+ message_id: Required if inline_message_id is not specified. Identifier of the message to edit.
79
+ inline_message_id: Required if chat_id and message_id are not specified. Identifier of the inline message.
80
+ caption: New caption of the message, 0-1024 characters after entities parsing
81
+ parse_mode: Mode for parsing entities in the message caption. See formatting options for more details.
82
+ caption_entities: A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parse_mode
83
+ show_caption_above_media: Pass True if the caption must be shown above the message media. Supported only for animation, live photo, paid media, photo, video and widget messages.
84
+ reply_markup: A JSON-serialized object for an inline keyboard
85
+
86
+ https://core.telegram.org/bots/api#editmessagecaption
87
+ """
88
+ return await self._call('editMessageCaption', locals(), 'Message|bool')
89
+
90
+ async def edit_message_media(
91
+ self,
92
+ media: InputMedia,
93
+ *,
94
+ business_connection_id: str | None = None,
95
+ chat_id: int | str | None = None,
96
+ message_id: int | None = None,
97
+ inline_message_id: str | None = None,
98
+ reply_markup: InlineKeyboardMarkup | None = None,
99
+ ) -> Message | bool:
100
+ """Use this method to edit animation, audio, document, live photo, photo, or video messages, or to replace a text or a rich message with media. If a message is part of a message album, then it can be edited only to an audio for audio albums, only to a document for document albums and to a photo, a live photo, or a video otherwise. When an inline message is edited, a new file can't be uploaded; use a previously uploaded file via its file_id or specify a URL. On success, if the edited message is not an inline message, the edited Message is returned; otherwise, True is returned. Note that business messages that were not sent by the bot and do not contain an inline keyboard can only be edited within 48 hours from the time they were sent.
101
+
102
+ Args:
103
+ business_connection_id: Unique identifier of the business connection on behalf of which the message to be edited was sent
104
+ chat_id: Required if inline_message_id is not specified. Unique identifier for the target chat or username of the target bot, supergroup, or channel in the format @username.
105
+ message_id: Required if inline_message_id is not specified. Identifier of the message to edit.
106
+ inline_message_id: Required if chat_id and message_id are not specified. Identifier of the inline message.
107
+ media: A JSON-serialized object for the new media content of the message
108
+ reply_markup: A JSON-serialized object for a new inline keyboard
109
+
110
+ https://core.telegram.org/bots/api#editmessagemedia
111
+ """
112
+ return await self._call('editMessageMedia', locals(), 'Message|bool')