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,121 @@
1
+ from __future__ import annotations
2
+
3
+ from ..core.caller import AsyncCaller
4
+ from ..types import ChatInviteLink
5
+
6
+
7
+ class AsyncMethods17(AsyncCaller):
8
+ __slots__ = ()
9
+
10
+ async def create_chat_subscription_invite_link(
11
+ self,
12
+ chat_id: int | str,
13
+ subscription_period: int,
14
+ subscription_price: int,
15
+ *,
16
+ name: str | None = None,
17
+ ) -> ChatInviteLink:
18
+ """Use this method to create a subscription invite link for a channel chat. The bot must have the can_invite_users administrator right. The link can be edited using the method editChatSubscriptionInviteLink or revoked using the method revokeChatInviteLink. Returns the new invite link as a ChatInviteLink object.
19
+
20
+ Args:
21
+ chat_id: Unique identifier for the target channel chat or username of the target channel in the format @username
22
+ name: Invite link name; 0-32 characters
23
+ subscription_period: The number of seconds the subscription will be active for before the next payment. Currently, it must always be 2592000 (30 days).
24
+ subscription_price: The amount of Telegram Stars a user must pay initially and after each subsequent subscription period to be a member of the chat; 1-10000
25
+
26
+ https://core.telegram.org/bots/api#createchatsubscriptioninvitelink
27
+ """
28
+ return await self._call('createChatSubscriptionInviteLink', locals(), 'ChatInviteLink')
29
+
30
+ async def edit_chat_subscription_invite_link(
31
+ self,
32
+ chat_id: int | str,
33
+ invite_link: str,
34
+ *,
35
+ name: str | None = None,
36
+ ) -> ChatInviteLink:
37
+ """Use this method to edit a subscription invite link created by the bot. The bot must have the can_invite_users administrator right. Returns the edited invite link as a ChatInviteLink object.
38
+
39
+ Args:
40
+ chat_id: Unique identifier for the target chat or username of the target channel in the format @username
41
+ invite_link: The invite link to edit
42
+ name: Invite link name; 0-32 characters
43
+
44
+ https://core.telegram.org/bots/api#editchatsubscriptioninvitelink
45
+ """
46
+ return await self._call('editChatSubscriptionInviteLink', locals(), 'ChatInviteLink')
47
+
48
+ async def revoke_chat_invite_link(
49
+ self,
50
+ chat_id: int | str,
51
+ invite_link: str,
52
+ ) -> ChatInviteLink:
53
+ """Use this method to revoke an invite link created by the bot. If the primary link is revoked, a new link is automatically generated. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns the revoked invite link as a ChatInviteLink object.
54
+
55
+ Args:
56
+ chat_id: Unique identifier of the target chat or username of the target channel in the format @username
57
+ invite_link: The invite link to revoke
58
+
59
+ https://core.telegram.org/bots/api#revokechatinvitelink
60
+ """
61
+ return await self._call('revokeChatInviteLink', locals(), 'ChatInviteLink')
62
+
63
+ async def approve_chat_join_request(
64
+ self,
65
+ chat_id: int | str,
66
+ user_id: int,
67
+ ) -> bool:
68
+ """Use this method to approve a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success.
69
+
70
+ Args:
71
+ chat_id: Unique identifier for the target chat or username of the target channel in the format @username
72
+ user_id: Unique identifier of the target user
73
+
74
+ https://core.telegram.org/bots/api#approvechatjoinrequest
75
+ """
76
+ return await self._call('approveChatJoinRequest', locals(), 'bool')
77
+
78
+ async def decline_chat_join_request(
79
+ self,
80
+ chat_id: int | str,
81
+ user_id: int,
82
+ ) -> bool:
83
+ """Use this method to decline a chat join request. The bot must be an administrator in the chat for this to work and must have the can_invite_users administrator right. Returns True on success.
84
+
85
+ Args:
86
+ chat_id: Unique identifier for the target chat or username of the target channel in the format @username
87
+ user_id: Unique identifier of the target user
88
+
89
+ https://core.telegram.org/bots/api#declinechatjoinrequest
90
+ """
91
+ return await self._call('declineChatJoinRequest', locals(), 'bool')
92
+
93
+ async def answer_chat_join_request_query(
94
+ self,
95
+ chat_join_request_query_id: str,
96
+ result: str,
97
+ ) -> bool:
98
+ """Use this method to process a received chat join request query. Returns True on success.
99
+
100
+ Args:
101
+ chat_join_request_query_id: Unique identifier of the join request query
102
+ result: Result of the query. Must be either “approve” to allow the user to join the chat, “decline” to disallow the user to join the chat, or “queue” to leave the decision to other administrators.
103
+
104
+ https://core.telegram.org/bots/api#answerchatjoinrequestquery
105
+ """
106
+ return await self._call('answerChatJoinRequestQuery', locals(), 'bool')
107
+
108
+ async def send_chat_join_request_web_app(
109
+ self,
110
+ chat_join_request_query_id: str,
111
+ web_app_url: str,
112
+ ) -> bool:
113
+ """Use this method to process a received chat join request query by showing a Mini App to the user before deciding the outcome. Call answerChatJoinRequestQuery to resolve the join request query based on the user interaction with the Mini App. Returns True on success.
114
+
115
+ Args:
116
+ chat_join_request_query_id: Unique identifier of the join request query
117
+ web_app_url: An HTTPS URL of a Web App to be opened with additional data as specified in Initializing Web Apps
118
+
119
+ https://core.telegram.org/bots/api#sendchatjoinrequestwebapp
120
+ """
121
+ return await self._call('sendChatJoinRequestWebApp', locals(), 'bool')
@@ -0,0 +1,118 @@
1
+ from __future__ import annotations
2
+
3
+ from ..core.caller import AsyncCaller
4
+ from ..core.input_file import InputFile
5
+
6
+
7
+ class AsyncMethods18(AsyncCaller):
8
+ __slots__ = ()
9
+
10
+ async def set_chat_photo(
11
+ self,
12
+ chat_id: int | str,
13
+ photo: InputFile,
14
+ ) -> bool:
15
+ """Use this method to set a new profile photo for the chat. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
16
+
17
+ Args:
18
+ chat_id: Unique identifier for the target chat or username of the target channel in the format @username
19
+ photo: New chat photo, uploaded using multipart/form-data
20
+
21
+ https://core.telegram.org/bots/api#setchatphoto
22
+ """
23
+ return await self._call('setChatPhoto', locals(), 'bool')
24
+
25
+ async def delete_chat_photo(
26
+ self,
27
+ chat_id: int | str,
28
+ ) -> bool:
29
+ """Use this method to delete a chat photo. Photos can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
30
+
31
+ Args:
32
+ chat_id: Unique identifier for the target chat or username of the target channel in the format @username
33
+
34
+ https://core.telegram.org/bots/api#deletechatphoto
35
+ """
36
+ return await self._call('deleteChatPhoto', locals(), 'bool')
37
+
38
+ async def set_chat_title(
39
+ self,
40
+ chat_id: int | str,
41
+ title: str,
42
+ ) -> bool:
43
+ """Use this method to change the title of a chat. Titles can't be changed for private chats. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
44
+
45
+ Args:
46
+ chat_id: Unique identifier for the target chat or username of the target channel in the format @username
47
+ title: New chat title, 1-128 characters
48
+
49
+ https://core.telegram.org/bots/api#setchattitle
50
+ """
51
+ return await self._call('setChatTitle', locals(), 'bool')
52
+
53
+ async def set_chat_description(
54
+ self,
55
+ chat_id: int | str,
56
+ *,
57
+ description: str | None = None,
58
+ ) -> bool:
59
+ """Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
60
+
61
+ Args:
62
+ chat_id: Unique identifier for the target chat or username of the target channel in the format @username
63
+ description: New chat description, 0-255 characters
64
+
65
+ https://core.telegram.org/bots/api#setchatdescription
66
+ """
67
+ return await self._call('setChatDescription', locals(), 'bool')
68
+
69
+ async def pin_chat_message(
70
+ self,
71
+ chat_id: int | str,
72
+ message_id: int,
73
+ *,
74
+ business_connection_id: str | None = None,
75
+ disable_notification: bool | None = None,
76
+ ) -> bool:
77
+ """Use this method to add a message to the list of pinned messages in a chat. In private chats and channel direct messages chats, all non-service messages can be pinned. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to pin messages in groups and channels respectively. Returns True on success.
78
+
79
+ Args:
80
+ business_connection_id: Unique identifier of the business connection on behalf of which the message will be pinned
81
+ chat_id: Unique identifier for the target chat or username of the target channel in the format @username
82
+ message_id: Identifier of a message to pin
83
+ disable_notification: Pass True if it is not necessary to send a notification to all chat members about the new pinned message. Notifications are always disabled in channels and private chats.
84
+
85
+ https://core.telegram.org/bots/api#pinchatmessage
86
+ """
87
+ return await self._call('pinChatMessage', locals(), 'bool')
88
+
89
+ async def unpin_chat_message(
90
+ self,
91
+ chat_id: int | str,
92
+ *,
93
+ business_connection_id: str | None = None,
94
+ message_id: int | None = None,
95
+ ) -> bool:
96
+ """Use this method to remove a message from the list of pinned messages in a chat. In private chats and channel direct messages chats, all messages can be unpinned. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to unpin messages in groups and channels respectively. Returns True on success.
97
+
98
+ Args:
99
+ business_connection_id: Unique identifier of the business connection on behalf of which the message will be unpinned
100
+ chat_id: Unique identifier for the target chat or username of the target channel in the format @username
101
+ message_id: Identifier of the message to unpin. Required if business_connection_id is specified. If not specified, the most recent pinned message (by sending date) will be unpinned.
102
+
103
+ https://core.telegram.org/bots/api#unpinchatmessage
104
+ """
105
+ return await self._call('unpinChatMessage', locals(), 'bool')
106
+
107
+ async def unpin_all_chat_messages(
108
+ self,
109
+ chat_id: int | str,
110
+ ) -> bool:
111
+ """Use this method to clear the list of pinned messages in a chat. In private chats and channel direct messages chats, no additional rights are required to unpin all pinned messages. Conversely, the bot must be an administrator with the 'can_pin_messages' right or the 'can_edit_messages' right to unpin all pinned messages in groups and channels respectively. Returns True on success.
112
+
113
+ Args:
114
+ chat_id: Unique identifier for the target chat or username of the target channel in the format @username
115
+
116
+ https://core.telegram.org/bots/api#unpinallchatmessages
117
+ """
118
+ return await self._call('unpinAllChatMessages', locals(), 'bool')
@@ -0,0 +1,128 @@
1
+ from __future__ import annotations
2
+
3
+ from ..core.caller import AsyncCaller
4
+ from ..types import ChatFullInfo, ChatMember, ChatShareThemeBackdrops, Message
5
+
6
+
7
+ class AsyncMethods19(AsyncCaller):
8
+ __slots__ = ()
9
+
10
+ async def leave_chat(
11
+ self,
12
+ chat_id: int | str,
13
+ ) -> bool:
14
+ """Use this method for your bot to leave a group, supergroup or channel. Returns True on success.
15
+
16
+ Args:
17
+ chat_id: Unique identifier for the target chat or username of the target supergroup or channel in the format @username. Channel direct messages chats aren't supported; leave the corresponding channel instead.
18
+
19
+ https://core.telegram.org/bots/api#leavechat
20
+ """
21
+ return await self._call('leaveChat', locals(), 'bool')
22
+
23
+ async def get_chat(
24
+ self,
25
+ chat_id: int | str,
26
+ ) -> ChatFullInfo:
27
+ """Use this method to get up-to-date information about the chat. Returns a ChatFullInfo object on success.
28
+
29
+ Args:
30
+ chat_id: Unique identifier for the target chat or username of the target supergroup or channel in the format @username
31
+
32
+ https://core.telegram.org/bots/api#getchat
33
+ """
34
+ return await self._call('getChat', locals(), 'ChatFullInfo')
35
+
36
+ async def get_chat_administrators(
37
+ self,
38
+ chat_id: int | str,
39
+ *,
40
+ return_bots: bool | None = None,
41
+ ) -> list[ChatMember]:
42
+ """Use this method to get a list of administrators in a chat. Returns an Array of ChatMember objects.
43
+
44
+ Args:
45
+ chat_id: Unique identifier for the target chat or username of the target supergroup or channel in the format @username
46
+ return_bots: Pass True to additionally receive all bots that are administrators of the chat. By default, bots other than the current bot are omitted.
47
+
48
+ https://core.telegram.org/bots/api#getchatadministrators
49
+ """
50
+ return await self._call('getChatAdministrators', locals(), 'list[ChatMember]')
51
+
52
+ async def get_chat_member_count(
53
+ self,
54
+ chat_id: int | str,
55
+ ) -> int:
56
+ """Use this method to get the number of members in a chat. Returns Integer on success.
57
+
58
+ Args:
59
+ chat_id: Unique identifier for the target chat or username of the target supergroup or channel in the format @username
60
+
61
+ https://core.telegram.org/bots/api#getchatmembercount
62
+ """
63
+ return await self._call('getChatMemberCount', locals(), 'int')
64
+
65
+ async def get_chat_member(
66
+ self,
67
+ chat_id: int | str,
68
+ user_id: int,
69
+ ) -> ChatMember:
70
+ """Use this method to get information about a member of a chat. The method is only guaranteed to work for other users if the bot is an administrator in the chat. Returns a ChatMember object on success.
71
+
72
+ Args:
73
+ chat_id: Unique identifier for the target chat or username of the target supergroup or channel in the format @username
74
+ user_id: Unique identifier of the target user
75
+
76
+ https://core.telegram.org/bots/api#getchatmember
77
+ """
78
+ return await self._call('getChatMember', locals(), 'ChatMember')
79
+
80
+ async def get_chat_share_theme_backdrops(self) -> ChatShareThemeBackdrops:
81
+ """Use this method to get the list of backdrops, which can be used as the background of a theme of the screen for sharing a link to a user or a chat. Requires no parameters. Returns a ChatShareThemeBackdrops object.
82
+
83
+ https://core.telegram.org/bots/api#getchatsharethemebackdrops
84
+ """
85
+ return await self._call('getChatShareThemeBackdrops', {}, 'ChatShareThemeBackdrops')
86
+
87
+ async def get_user_personal_chat_messages(
88
+ self,
89
+ user_id: int,
90
+ limit: int,
91
+ ) -> list[Message]:
92
+ """Use this method to get the last messages from the personal chat (i.e., the chat currently added to their profile) of a given user. On success, an Array of Message objects is returned.
93
+
94
+ Args:
95
+ user_id: Unique identifier for the target user
96
+ limit: The maximum number of messages to return; 1-20
97
+
98
+ https://core.telegram.org/bots/api#getuserpersonalchatmessages
99
+ """
100
+ return await self._call('getUserPersonalChatMessages', locals(), 'list[Message]')
101
+
102
+ async def set_chat_sticker_set(
103
+ self,
104
+ chat_id: int | str,
105
+ sticker_set_name: str,
106
+ ) -> bool:
107
+ """Use this method to set a new group sticker set for a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success.
108
+
109
+ Args:
110
+ chat_id: Unique identifier for the target chat or username of the target supergroup in the format @username
111
+ sticker_set_name: Name of the sticker set to be set as the group sticker set
112
+
113
+ https://core.telegram.org/bots/api#setchatstickerset
114
+ """
115
+ return await self._call('setChatStickerSet', locals(), 'bool')
116
+
117
+ async def delete_chat_sticker_set(
118
+ self,
119
+ chat_id: int | str,
120
+ ) -> bool:
121
+ """Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. Returns True on success.
122
+
123
+ Args:
124
+ chat_id: Unique identifier for the target chat or username of the target supergroup in the format @username
125
+
126
+ https://core.telegram.org/bots/api#deletechatstickerset
127
+ """
128
+ return await self._call('deleteChatStickerSet', locals(), 'bool')
@@ -0,0 +1,115 @@
1
+ from __future__ import annotations
2
+
3
+ from ..core.caller import AsyncCaller
4
+ from ..types import ForumTopic, Sticker
5
+
6
+
7
+ class AsyncMethods20(AsyncCaller):
8
+ __slots__ = ()
9
+
10
+ async def get_forum_topic_icon_stickers(self) -> list[Sticker]:
11
+ """Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user. Requires no parameters. Returns an Array of Sticker objects.
12
+
13
+ https://core.telegram.org/bots/api#getforumtopiciconstickers
14
+ """
15
+ return await self._call('getForumTopicIconStickers', {}, 'list[Sticker]')
16
+
17
+ async def create_forum_topic(
18
+ self,
19
+ chat_id: int | str,
20
+ name: str,
21
+ *,
22
+ icon_color: int | None = None,
23
+ icon_custom_emoji_id: str | None = None,
24
+ ) -> ForumTopic:
25
+ """Use this method to create a topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator right. In the case of a private chat, a link to the topic can be created in the format https://t.me/<bot_username>/<message_thread_id>; the link opens the topic only for the user. Returns information about the created topic as a ForumTopic object.
26
+
27
+ Args:
28
+ chat_id: Unique identifier for the target chat or username of the target supergroup in the format @username
29
+ name: Topic name, 1-128 characters
30
+ icon_color: Color of the topic icon in RGB format. Currently, must be one of 7322096 (0x6FB9F0), 16766590 (0xFFD67E), 13338331 (0xCB86DB), 9367192 (0x8EEE98), 16749490 (0xFF93B2), or 16478047 (0xFB6F5F).
31
+ icon_custom_emoji_id: Unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers.
32
+
33
+ https://core.telegram.org/bots/api#createforumtopic
34
+ """
35
+ return await self._call('createForumTopic', locals(), 'ForumTopic')
36
+
37
+ async def edit_forum_topic(
38
+ self,
39
+ chat_id: int | str,
40
+ message_thread_id: int,
41
+ *,
42
+ name: str | None = None,
43
+ icon_custom_emoji_id: str | None = None,
44
+ ) -> bool:
45
+ """Use this method to edit the name and icon of a topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator right, unless it is the creator of the topic. Returns True on success.
46
+
47
+ Args:
48
+ chat_id: Unique identifier for the target chat or username of the target supergroup in the format @username
49
+ message_thread_id: Unique identifier for the target message thread of the forum topic
50
+ name: New topic name, 0-128 characters. If not specified or empty, the current name of the topic will be kept.
51
+ icon_custom_emoji_id: New unique identifier of the custom emoji shown as the topic icon. Use getForumTopicIconStickers to get all allowed custom emoji identifiers. Pass an empty string to remove the icon. If not specified, the current icon will be kept.
52
+
53
+ https://core.telegram.org/bots/api#editforumtopic
54
+ """
55
+ return await self._call('editForumTopic', locals(), 'bool')
56
+
57
+ async def close_forum_topic(
58
+ self,
59
+ chat_id: int | str,
60
+ message_thread_id: int,
61
+ ) -> bool:
62
+ """Use this method to close an open topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator right, unless it is the creator of the topic. Returns True on success.
63
+
64
+ Args:
65
+ chat_id: Unique identifier for the target chat or username of the target supergroup in the format @username
66
+ message_thread_id: Unique identifier for the target message thread of the forum topic
67
+
68
+ https://core.telegram.org/bots/api#closeforumtopic
69
+ """
70
+ return await self._call('closeForumTopic', locals(), 'bool')
71
+
72
+ async def reopen_forum_topic(
73
+ self,
74
+ chat_id: int | str,
75
+ message_thread_id: int,
76
+ ) -> bool:
77
+ """Use this method to reopen a closed topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator right, unless it is the creator of the topic. Returns True on success.
78
+
79
+ Args:
80
+ chat_id: Unique identifier for the target chat or username of the target supergroup in the format @username
81
+ message_thread_id: Unique identifier for the target message thread of the forum topic
82
+
83
+ https://core.telegram.org/bots/api#reopenforumtopic
84
+ """
85
+ return await self._call('reopenForumTopic', locals(), 'bool')
86
+
87
+ async def delete_forum_topic(
88
+ self,
89
+ chat_id: int | str,
90
+ message_thread_id: int,
91
+ ) -> bool:
92
+ """Use this method to delete a forum topic along with all its messages in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_delete_messages administrator right. Returns True on success.
93
+
94
+ Args:
95
+ chat_id: Unique identifier for the target chat or username of the target supergroup in the format @username
96
+ message_thread_id: Unique identifier for the target message thread of the forum topic
97
+
98
+ https://core.telegram.org/bots/api#deleteforumtopic
99
+ """
100
+ return await self._call('deleteForumTopic', locals(), 'bool')
101
+
102
+ async def unpin_all_forum_topic_messages(
103
+ self,
104
+ chat_id: int | str,
105
+ message_thread_id: int,
106
+ ) -> bool:
107
+ """Use this method to clear the list of pinned messages in a forum topic in a forum supergroup chat or a private chat with a user. In the case of a supergroup chat the bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success.
108
+
109
+ Args:
110
+ chat_id: Unique identifier for the target chat or username of the target supergroup in the format @username
111
+ message_thread_id: Unique identifier for the target message thread of the forum topic
112
+
113
+ https://core.telegram.org/bots/api#unpinallforumtopicmessages
114
+ """
115
+ return await self._call('unpinAllForumTopicMessages', locals(), 'bool')
@@ -0,0 +1,127 @@
1
+ from __future__ import annotations
2
+
3
+ from ..core.caller import AsyncCaller
4
+
5
+
6
+ class AsyncMethods21(AsyncCaller):
7
+ __slots__ = ()
8
+
9
+ async def edit_general_forum_topic(
10
+ self,
11
+ chat_id: int | str,
12
+ name: str,
13
+ ) -> bool:
14
+ """Use this method to edit the name of the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator right. Returns True on success.
15
+
16
+ Args:
17
+ chat_id: Unique identifier for the target chat or username of the target supergroup in the format @username
18
+ name: New topic name, 1-128 characters
19
+
20
+ https://core.telegram.org/bots/api#editgeneralforumtopic
21
+ """
22
+ return await self._call('editGeneralForumTopic', locals(), 'bool')
23
+
24
+ async def close_general_forum_topic(
25
+ self,
26
+ chat_id: int | str,
27
+ ) -> bool:
28
+ """Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator right. Returns True on success.
29
+
30
+ Args:
31
+ chat_id: Unique identifier for the target chat or username of the target supergroup in the format @username
32
+
33
+ https://core.telegram.org/bots/api#closegeneralforumtopic
34
+ """
35
+ return await self._call('closeGeneralForumTopic', locals(), 'bool')
36
+
37
+ async def reopen_general_forum_topic(
38
+ self,
39
+ chat_id: int | str,
40
+ ) -> bool:
41
+ """Use this method to reopen a closed 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator right. The topic will be automatically unhidden if it was hidden. Returns True on success.
42
+
43
+ Args:
44
+ chat_id: Unique identifier for the target chat or username of the target supergroup in the format @username
45
+
46
+ https://core.telegram.org/bots/api#reopengeneralforumtopic
47
+ """
48
+ return await self._call('reopenGeneralForumTopic', locals(), 'bool')
49
+
50
+ async def hide_general_forum_topic(
51
+ self,
52
+ chat_id: int | str,
53
+ ) -> bool:
54
+ """Use this method to hide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator right. The topic will be automatically closed if it was open. Returns True on success.
55
+
56
+ Args:
57
+ chat_id: Unique identifier for the target chat or username of the target supergroup in the format @username
58
+
59
+ https://core.telegram.org/bots/api#hidegeneralforumtopic
60
+ """
61
+ return await self._call('hideGeneralForumTopic', locals(), 'bool')
62
+
63
+ async def unhide_general_forum_topic(
64
+ self,
65
+ chat_id: int | str,
66
+ ) -> bool:
67
+ """Use this method to unhide the 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator right. Returns True on success.
68
+
69
+ Args:
70
+ chat_id: Unique identifier for the target chat or username of the target supergroup in the format @username
71
+
72
+ https://core.telegram.org/bots/api#unhidegeneralforumtopic
73
+ """
74
+ return await self._call('unhideGeneralForumTopic', locals(), 'bool')
75
+
76
+ async def unpin_all_general_forum_topic_messages(
77
+ self,
78
+ chat_id: int | str,
79
+ ) -> bool:
80
+ """Use this method to clear the list of pinned messages in a General forum topic. The bot must be an administrator in the chat for this to work and must have the can_pin_messages administrator right in the supergroup. Returns True on success.
81
+
82
+ Args:
83
+ chat_id: Unique identifier for the target chat or username of the target supergroup in the format @username
84
+
85
+ https://core.telegram.org/bots/api#unpinallgeneralforumtopicmessages
86
+ """
87
+ return await self._call('unpinAllGeneralForumTopicMessages', locals(), 'bool')
88
+
89
+ async def answer_callback_query(
90
+ self,
91
+ callback_query_id: str,
92
+ *,
93
+ text: str | None = None,
94
+ show_alert: bool | None = None,
95
+ url: str | None = None,
96
+ cache_time: int | None = None,
97
+ ) -> bool:
98
+ """Use this method to send answers to callback queries sent from inline keyboards or rich messages. The answer will be displayed to the user as a notification at the top of the chat screen or as an alert. On success, True is returned.
99
+
100
+ Alternatively, the user can be redirected to the specified Game URL. For this option to work, you must first create a game for your bot via @BotFather and accept the terms. Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter.
101
+
102
+ Args:
103
+ callback_query_id: Unique identifier for the query to be answered
104
+ text: Text of the notification. If not specified, nothing will be shown to the user, 0-200 characters.
105
+ show_alert: If True, an alert will be shown by the client instead of a notification at the top of the chat screen. Defaults to False.
106
+ url: URL that will be opened by the user's client. If you have created a Game and accepted the conditions via @BotFather, specify the URL that opens your game - note that this will only work if the query comes from a callback_game button. Otherwise, you may use links like t.me/your_bot?start=XXXX that open your bot with a parameter.
107
+ cache_time: The maximum amount of time in seconds that the result of the callback query may be cached client-side. Defaults to 0.
108
+
109
+ https://core.telegram.org/bots/api#answercallbackquery
110
+ """
111
+ return await self._call('answerCallbackQuery', locals(), 'bool')
112
+
113
+ async def answer_widget_query(
114
+ self,
115
+ widget_query_id: str,
116
+ *,
117
+ data: str | None = None,
118
+ ) -> bool:
119
+ """Use this method to send an answer to a query from a widget. The query must be answered within 15 seconds. The answer is received only by the widget that sent the query and doesn't change data of the widget; use editMessageWidgetData or editSharedWidgetData to change it. On success, True is returned.
120
+
121
+ Args:
122
+ widget_query_id: Unique identifier for the query to be answered
123
+ data: Data to be returned to the widget, 0-1024 bytes
124
+
125
+ https://core.telegram.org/bots/api#answerwidgetquery
126
+ """
127
+ return await self._call('answerWidgetQuery', locals(), 'bool')