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,112 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+ from typing import TYPE_CHECKING
5
+
6
+ from ..core.base import BotObject
7
+
8
+ if TYPE_CHECKING:
9
+ from ..core.input_file import InputFile
10
+ from .available_types_04 import MessageEntity
11
+
12
+ __all__ = ['InputMediaSticker', 'InputMediaVenue', 'InputMediaVideo', 'InputMediaVoiceNote']
13
+
14
+
15
+ @dataclass(kw_only=True, slots=True)
16
+ class InputMediaSticker(BotObject):
17
+ """Represents a sticker file to be sent.
18
+
19
+ https://core.telegram.org/bots/api#inputmediasticker
20
+ """
21
+
22
+ type: str = 'sticker'
23
+ """Type of the media, must be sticker"""
24
+ media: InputFile | str
25
+ """File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a .WEBP sticker from the Internet, or pass “attach://<file_attach_name>” to upload a new .WEBP, .TGS, or .WEBM sticker using multipart/form-data under <file_attach_name> name. More information on Sending Files »"""
26
+ emoji: str | None = None
27
+ """Optional. Emoji associated with the sticker; only for just uploaded stickers"""
28
+
29
+
30
+ @dataclass(kw_only=True, slots=True)
31
+ class InputMediaVenue(BotObject):
32
+ """Represents a venue to be sent.
33
+
34
+ https://core.telegram.org/bots/api#inputmediavenue
35
+ """
36
+
37
+ type: str = 'venue'
38
+ """Type of the media, must be venue"""
39
+ latitude: float
40
+ """Latitude of the location"""
41
+ longitude: float
42
+ """Longitude of the location"""
43
+ title: str
44
+ """Name of the venue"""
45
+ address: str
46
+ """Address of the venue"""
47
+ foursquare_id: str | None = None
48
+ """Optional. Foursquare identifier of the venue"""
49
+ foursquare_type: str | None = None
50
+ """Optional. Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)"""
51
+ google_place_id: str | None = None
52
+ """Optional. Google Places identifier of the venue"""
53
+ google_place_type: str | None = None
54
+ """Optional. Google Places type of the venue. (See supported types.)"""
55
+
56
+
57
+ @dataclass(kw_only=True, slots=True)
58
+ class InputMediaVideo(BotObject):
59
+ """Represents a video to be sent.
60
+
61
+ https://core.telegram.org/bots/api#inputmediavideo
62
+ """
63
+
64
+ type: str = 'video'
65
+ """Type of the media, must be video"""
66
+ media: InputFile | str
67
+ """File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files »"""
68
+ thumbnail: InputFile | str | None = None
69
+ """Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can only be uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files »"""
70
+ cover: InputFile | str | None = None
71
+ """Optional. Cover for the video in the message. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files »"""
72
+ start_timestamp: int | None = None
73
+ """Optional. Start timestamp for the video in the message"""
74
+ caption: str | None = None
75
+ """Optional. Caption of the video to be sent, 0-1024 characters after entities parsing"""
76
+ parse_mode: str | None = None
77
+ """Optional. Mode for parsing entities in the video caption. See formatting options for more details."""
78
+ caption_entities: list[MessageEntity] | None = None
79
+ """Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode"""
80
+ show_caption_above_media: bool | None = None
81
+ """Optional. Pass True if the caption must be shown above the message media"""
82
+ width: int | None = None
83
+ """Optional. Video width"""
84
+ height: int | None = None
85
+ """Optional. Video height"""
86
+ duration: int | None = None
87
+ """Optional. Video duration in seconds"""
88
+ supports_streaming: bool | None = None
89
+ """Optional. Pass True if the uploaded video is suitable for streaming"""
90
+ has_spoiler: bool | None = None
91
+ """Optional. Pass True if the video needs to be covered with a spoiler animation"""
92
+
93
+
94
+ @dataclass(kw_only=True, slots=True)
95
+ class InputMediaVoiceNote(BotObject):
96
+ """Represents a voice message file to be sent.
97
+
98
+ https://core.telegram.org/bots/api#inputmediavoicenote
99
+ """
100
+
101
+ type: str = 'voice_note'
102
+ """Type of the media, must be voice_note"""
103
+ media: InputFile | str
104
+ """File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files »"""
105
+ caption: str | None = None
106
+ """Optional. Caption of the voice message to be sent, 0-1024 characters after entities parsing"""
107
+ parse_mode: str | None = None
108
+ """Optional. Mode for parsing entities in the voice message caption. See formatting options for more details."""
109
+ caption_entities: list[MessageEntity] | None = None
110
+ """Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode"""
111
+ duration: int | None = None
112
+ """Optional. Duration of the voice message in seconds"""
@@ -0,0 +1,110 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+ from typing import TYPE_CHECKING
5
+
6
+ from ..core.base import BotObject
7
+
8
+ if TYPE_CHECKING:
9
+ from ..core.input_file import InputFile
10
+
11
+ __all__ = [
12
+ 'InputPaidMediaLivePhoto', 'InputPaidMediaPhoto', 'InputPaidMediaVideo',
13
+ 'InputProfilePhotoAnimated', 'InputProfilePhotoStatic', 'InputStoryContentPhoto',
14
+ ]
15
+
16
+
17
+ @dataclass(kw_only=True, slots=True)
18
+ class InputPaidMediaLivePhoto(BotObject):
19
+ """The paid media to send is a live photo.
20
+
21
+ https://core.telegram.org/bots/api#inputpaidmedialivephoto
22
+ """
23
+
24
+ type: str = 'live_photo'
25
+ """Type of the media, must be live_photo"""
26
+ media: InputFile | str
27
+ """Video of the live photo to send. Pass a file_id to send a file that exists on the Telegram servers (recommended) or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files ». Sending live photos by a URL is currently unsupported."""
28
+ photo: InputFile | str
29
+ """The static photo to send. Pass a file_id to send a file that exists on the Telegram servers (recommended) or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files ». Sending live photos by a URL is currently unsupported."""
30
+
31
+
32
+ @dataclass(kw_only=True, slots=True)
33
+ class InputPaidMediaPhoto(BotObject):
34
+ """The paid media to send is a photo.
35
+
36
+ https://core.telegram.org/bots/api#inputpaidmediaphoto
37
+ """
38
+
39
+ type: str = 'photo'
40
+ """Type of the media, must be photo"""
41
+ media: InputFile | str
42
+ """File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files »"""
43
+
44
+
45
+ @dataclass(kw_only=True, slots=True)
46
+ class InputPaidMediaVideo(BotObject):
47
+ """The paid media to send is a video.
48
+
49
+ https://core.telegram.org/bots/api#inputpaidmediavideo
50
+ """
51
+
52
+ type: str = 'video'
53
+ """Type of the media, must be video"""
54
+ media: InputFile | str
55
+ """File to send. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files »"""
56
+ thumbnail: InputFile | str | None = None
57
+ """Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can only be uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files »"""
58
+ cover: InputFile | str | None = None
59
+ """Optional. Cover for the video in the message. Pass a file_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name. More information on Sending Files »"""
60
+ start_timestamp: int | None = None
61
+ """Optional. Start timestamp for the video in the message"""
62
+ width: int | None = None
63
+ """Optional. Video width"""
64
+ height: int | None = None
65
+ """Optional. Video height"""
66
+ duration: int | None = None
67
+ """Optional. Video duration in seconds"""
68
+ supports_streaming: bool | None = None
69
+ """Optional. Pass True if the uploaded video is suitable for streaming"""
70
+
71
+
72
+ @dataclass(kw_only=True, slots=True)
73
+ class InputProfilePhotoStatic(BotObject):
74
+ """A static profile photo in the .JPG format.
75
+
76
+ https://core.telegram.org/bots/api#inputprofilephotostatic
77
+ """
78
+
79
+ type: str = 'static'
80
+ """Type of the profile photo, must be static"""
81
+ photo: InputFile | str
82
+ """The static profile photo. Profile photos can't be reused and can only be uploaded as a new file, so you can pass “attach://<file_attach_name>” if the photo was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files »"""
83
+
84
+
85
+ @dataclass(kw_only=True, slots=True)
86
+ class InputProfilePhotoAnimated(BotObject):
87
+ """An animated profile photo in the MPEG4 format.
88
+
89
+ https://core.telegram.org/bots/api#inputprofilephotoanimated
90
+ """
91
+
92
+ type: str = 'animated'
93
+ """Type of the profile photo, must be animated"""
94
+ animation: InputFile | str
95
+ """The animated profile photo. Profile photos can't be reused and can only be uploaded as a new file, so you can pass “attach://<file_attach_name>” if the photo was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files »"""
96
+ main_frame_timestamp: float | None = None
97
+ """Optional. Timestamp in seconds of the frame that will be used as the static profile photo. Defaults to 0.0."""
98
+
99
+
100
+ @dataclass(kw_only=True, slots=True)
101
+ class InputStoryContentPhoto(BotObject):
102
+ """Describes a photo to post as a story.
103
+
104
+ https://core.telegram.org/bots/api#inputstorycontentphoto
105
+ """
106
+
107
+ type: str = 'photo'
108
+ """Type of the content, must be photo"""
109
+ photo: InputFile | str
110
+ """The photo to post as a story. The photo must be of the size 1080x1920 and must not exceed 10 MB. The photo can't be reused and can only be uploaded as a new file, so you can pass “attach://<file_attach_name>” if the photo was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files »"""
@@ -0,0 +1,30 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+ from typing import TYPE_CHECKING
5
+
6
+ from ..core.base import BotObject
7
+
8
+ if TYPE_CHECKING:
9
+ from ..core.input_file import InputFile
10
+
11
+ __all__ = ['InputStoryContentVideo']
12
+
13
+
14
+ @dataclass(kw_only=True, slots=True)
15
+ class InputStoryContentVideo(BotObject):
16
+ """Describes a video to post as a story.
17
+
18
+ https://core.telegram.org/bots/api#inputstorycontentvideo
19
+ """
20
+
21
+ type: str = 'video'
22
+ """Type of the content, must be video"""
23
+ video: InputFile | str
24
+ """The video to post as a story. The video must be of the size 720x1280, streamable, encoded with H.265 codec, with key frames added each second in the MPEG4 format, and must not exceed 30 MB. The video can't be reused and can only be uploaded as a new file, so you can pass “attach://<file_attach_name>” if the video was uploaded using multipart/form-data under <file_attach_name>. More information on Sending Files »"""
25
+ duration: float | None = None
26
+ """Optional. Precise duration of the video in seconds; 0-60"""
27
+ cover_frame_timestamp: float | None = None
28
+ """Optional. Timestamp in seconds of the frame that will be used as the static cover for the story. Defaults to 0.0."""
29
+ is_animation: bool | None = None
30
+ """Optional. Pass True if the video has no sound"""
@@ -0,0 +1,57 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+ from typing import TYPE_CHECKING
5
+
6
+ from ..core.base import BotObject
7
+
8
+ if TYPE_CHECKING:
9
+ from .available_types_01 import User
10
+ from .available_types_04 import MessageEntity
11
+ from .available_types_06 import Animation, PhotoSize
12
+
13
+ __all__ = ['CallbackGame', 'Game', 'GameHighScore']
14
+
15
+
16
+ @dataclass(kw_only=True, slots=True)
17
+ class Game(BotObject):
18
+ """This object represents a game. Use BotFather to create and edit games; their short names will act as unique identifiers.
19
+
20
+ https://core.telegram.org/bots/api#game
21
+ """
22
+
23
+ title: str
24
+ """Title of the game"""
25
+ description: str
26
+ """Description of the game"""
27
+ photo: list[PhotoSize]
28
+ """Photo that will be displayed in the game message in chats"""
29
+ text: str | None = None
30
+ """Optional. Brief description of the game or high scores included in the game message. Can be automatically edited to include current high scores for the game when the bot calls setGameScore, or manually edited using editMessageText. 0-4096 characters."""
31
+ text_entities: list[MessageEntity] | None = None
32
+ """Optional. Special entities that appear in text, such as usernames, URLs, bot commands, etc."""
33
+ animation: Animation | None = None
34
+ """Optional. Animation that will be displayed in the game message in chats. Upload via BotFather."""
35
+
36
+
37
+ @dataclass(kw_only=True, slots=True)
38
+ class CallbackGame(BotObject):
39
+ """A placeholder, currently holds no information. Use BotFather to set up your game.
40
+
41
+ https://core.telegram.org/bots/api#callbackgame
42
+ """
43
+
44
+
45
+ @dataclass(kw_only=True, slots=True)
46
+ class GameHighScore(BotObject):
47
+ """This object represents one row of the high scores table for a game.
48
+
49
+ https://core.telegram.org/bots/api#gamehighscore
50
+ """
51
+
52
+ position: int
53
+ """Position in high score table for the game"""
54
+ user: User
55
+ """User"""
56
+ score: int
57
+ """Score"""
@@ -0,0 +1,123 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+ from typing import TYPE_CHECKING
5
+
6
+ from ..core.base import BotObject
7
+
8
+ if TYPE_CHECKING:
9
+ from .available_types_03 import Message
10
+ from .available_types_10 import PollAnswer
11
+ from .available_types_11 import Poll
12
+ from .available_types_13 import (
13
+ BotSubscriptionUpdated, ManagedBotUpdated, MessageGenerationStopped,
14
+ )
15
+ from .available_types_23 import CallbackQuery, WidgetQuery
16
+ from .available_types_24 import SharedWidgetQuery
17
+ from .available_types_25 import ChatMemberUpdated
18
+ from .available_types_27 import ChatJoinRequest
19
+ from .available_types_32 import MessageReactionCountUpdated, MessageReactionUpdated
20
+ from .available_types_38 import ChatBoostRemoved, ChatBoostUpdated
21
+ from .available_types_39 import BusinessConnection, BusinessMessagesDeleted
22
+ from .inline_mode_01 import InlineQuery
23
+ from .inline_mode_09 import ChosenInlineResult
24
+ from .payments_02 import PaidMediaPurchased, PreCheckoutQuery, ShippingQuery
25
+
26
+ __all__ = ['Update', 'WebhookInfo']
27
+
28
+
29
+ @dataclass(kw_only=True, slots=True)
30
+ class Update(BotObject):
31
+ """This object represents an incoming update.
32
+ At most one of the optional fields can be present in any given update.
33
+
34
+ https://core.telegram.org/bots/api#update
35
+ """
36
+
37
+ update_id: int
38
+ """The update's unique identifier. Update identifiers start from a certain positive number and increase sequentially. This identifier becomes especially handy if you're using webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. If there are no new updates for at least a week, then the identifier of the next update will be chosen randomly instead of sequentially."""
39
+ message: Message | None = None
40
+ """Optional. New incoming message of any kind - text, photo, sticker, etc."""
41
+ edited_message: Message | None = None
42
+ """Optional. New version of a message that is known to the bot and was edited. This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot."""
43
+ channel_post: Message | None = None
44
+ """Optional. New incoming channel post of any kind - text, photo, sticker, etc."""
45
+ edited_channel_post: Message | None = None
46
+ """Optional. New version of a channel post that is known to the bot and was edited. This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot."""
47
+ business_connection: BusinessConnection | None = None
48
+ """Optional. The bot was connected to or disconnected from a business account, or a user edited an existing connection with the bot"""
49
+ business_message: Message | None = None
50
+ """Optional. New message from a connected business account"""
51
+ edited_business_message: Message | None = None
52
+ """Optional. New version of a message from a connected business account"""
53
+ deleted_business_messages: BusinessMessagesDeleted | None = None
54
+ """Optional. Messages were deleted from a connected business account"""
55
+ guest_message: Message | None = None
56
+ """Optional. New guest message. The bot can use the field Message.guest_query_id and the method answerGuestQuery to send a message in response."""
57
+ message_reaction: MessageReactionUpdated | None = None
58
+ """Optional. A reaction to a message was changed by a user. The bot must be an administrator in the chat and must explicitly specify "message_reaction" in the list of allowed_updates to receive these updates. The update isn't received for reactions set by bots."""
59
+ message_reaction_count: MessageReactionCountUpdated | None = None
60
+ """Optional. Reactions to a message with anonymous reactions were changed. The bot must be an administrator in the chat and must explicitly specify "message_reaction_count" in the list of allowed_updates to receive these updates. The updates are grouped and can be sent with a delay of up to a few minutes."""
61
+ inline_query: InlineQuery | None = None
62
+ """Optional. New incoming inline query"""
63
+ chosen_inline_result: ChosenInlineResult | None = None
64
+ """Optional. The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot. The updates can also be enabled using the parameter inline_feedback_share_denominator of the method setMySettings."""
65
+ callback_query: CallbackQuery | None = None
66
+ """Optional. New incoming callback query"""
67
+ widget_query: WidgetQuery | None = None
68
+ """Optional. New incoming query from a widget in a message sent by the bot or via the bot"""
69
+ shared_widget_query: SharedWidgetQuery | None = None
70
+ """Optional. New incoming query from a forwarded message with a shared widget"""
71
+ shipping_query: ShippingQuery | None = None
72
+ """Optional. New incoming shipping query. Only for invoices with flexible price."""
73
+ pre_checkout_query: PreCheckoutQuery | None = None
74
+ """Optional. New incoming pre-checkout query. Contains full information about checkout."""
75
+ purchased_paid_media: PaidMediaPurchased | None = None
76
+ """Optional. A user purchased paid media with a non-empty payload sent by the bot in a non-channel chat"""
77
+ poll: Poll | None = None
78
+ """Optional. New poll state. Bots receive only updates about manually stopped polls and polls which are sent by the bot."""
79
+ poll_answer: PollAnswer | None = None
80
+ """Optional. A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself."""
81
+ my_chat_member: ChatMemberUpdated | None = None
82
+ """Optional. The bot's chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user."""
83
+ chat_member: ChatMemberUpdated | None = None
84
+ """Optional. A chat member's status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify "chat_member" in the list of allowed_updates to receive these updates."""
85
+ chat_join_request: ChatJoinRequest | None = None
86
+ """Optional. A request to join the chat has been sent. The bot must have the can_invite_users administrator right in the chat to receive these updates."""
87
+ chat_boost: ChatBoostUpdated | None = None
88
+ """Optional. A chat boost was added or changed. The bot must be an administrator in the chat to receive these updates."""
89
+ removed_chat_boost: ChatBoostRemoved | None = None
90
+ """Optional. A boost was removed from a chat. The bot must be an administrator in the chat to receive these updates."""
91
+ managed_bot: ManagedBotUpdated | None = None
92
+ """Optional. A new bot was created to be managed by the bot, or the token or owner of a managed bot was changed"""
93
+ subscription: BotSubscriptionUpdated | None = None
94
+ """Optional. User payment subscription has changed"""
95
+ stopped_message_generation: MessageGenerationStopped | None = None
96
+ """Optional. A user asked the bot to stop the generation of a message"""
97
+
98
+
99
+ @dataclass(kw_only=True, slots=True)
100
+ class WebhookInfo(BotObject):
101
+ """Describes the current status of a webhook.
102
+
103
+ https://core.telegram.org/bots/api#webhookinfo
104
+ """
105
+
106
+ url: str
107
+ """Webhook URL, may be empty if webhook is not set up"""
108
+ has_custom_certificate: bool
109
+ """True, if a custom certificate was provided for webhook certificate checks"""
110
+ pending_update_count: int
111
+ """Number of updates awaiting delivery"""
112
+ ip_address: str | None = None
113
+ """Optional. Currently used webhook IP address"""
114
+ last_error_date: int | None = None
115
+ """Optional. Unix time for the most recent error that happened when trying to deliver an update via webhook"""
116
+ last_error_message: str | None = None
117
+ """Optional. Error message in human-readable format for the most recent error that happened when trying to deliver an update via webhook"""
118
+ last_synchronization_error_date: int | None = None
119
+ """Optional. Unix time of the most recent error that happened when trying to synchronize available updates with Telegram datacenters"""
120
+ max_connections: int | None = None
121
+ """Optional. The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery"""
122
+ allowed_updates: list[str] | None = None
123
+ """Optional. A list of update types the bot is subscribed to. Defaults to all update types except chat_member, message_reaction, and message_reaction_count."""
@@ -0,0 +1,124 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass, field
4
+ from typing import TYPE_CHECKING
5
+
6
+ from ..core.base import BotObject
7
+
8
+ if TYPE_CHECKING:
9
+ from .available_types_01 import User
10
+ from .available_types_04 import MessageEntity
11
+ from .available_types_12 import Location
12
+ from .available_types_20 import WebAppInfo
13
+ from .available_types_21 import InlineKeyboardMarkup
14
+ from .unions_05 import InputMessageContent
15
+
16
+ __all__ = [
17
+ 'InlineQuery', 'InlineQueryResultArticle', 'InlineQueryResultPhoto',
18
+ 'InlineQueryResultsButton',
19
+ ]
20
+
21
+
22
+ @dataclass(kw_only=True, slots=True)
23
+ class InlineQuery(BotObject):
24
+ """This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results.
25
+
26
+ https://core.telegram.org/bots/api#inlinequery
27
+ """
28
+
29
+ id: str
30
+ """Unique identifier for this query"""
31
+ from_user: User = field(metadata={"wire": 'from'})
32
+ """Sender"""
33
+ query: str
34
+ """Text of the query (up to 256 characters)"""
35
+ offset: str
36
+ """Offset of the results to be returned, can be controlled by the bot"""
37
+ chat_type: str | None = None
38
+ """Optional. Type of the chat from which the inline query was sent. Can be either “sender” for a private chat with the inline query sender, “private”, “group”, “supergroup”, or “channel”. The chat type should always be known for requests sent from official clients and most third-party clients, unless the request was sent from a secret chat."""
39
+ location: Location | None = None
40
+ """Optional. Sender location, only for bots that enabled user location requests via @BotFather or using the parameter needs_inline_query_location of the method setMySettings"""
41
+
42
+
43
+ @dataclass(kw_only=True, slots=True)
44
+ class InlineQueryResultsButton(BotObject):
45
+ """This object represents a button to be shown above inline query results. You must use exactly one of the optional fields.
46
+
47
+ https://core.telegram.org/bots/api#inlinequeryresultsbutton
48
+ """
49
+
50
+ text: str
51
+ """Label text on the button"""
52
+ web_app: WebAppInfo | None = None
53
+ """Optional. Description of the Web App that will be launched when the user presses the button. The Web App will be able to switch back to the inline mode using the method switchInlineQuery inside the Web App."""
54
+ start_parameter: str | None = None
55
+ """Optional. Deep-linking parameter for the /start message sent to the bot when a user presses the button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed.
56
+
57
+ Example: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an OAuth link. Once done, the bot can offer a switch_inline button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities.
58
+ """
59
+
60
+
61
+ @dataclass(kw_only=True, slots=True)
62
+ class InlineQueryResultArticle(BotObject):
63
+ """Represents a link to an article or web page.
64
+
65
+ https://core.telegram.org/bots/api#inlinequeryresultarticle
66
+ """
67
+
68
+ type: str = 'article'
69
+ """Type of the result, must be article"""
70
+ id: str
71
+ """Unique identifier for this result, 1-64 Bytes"""
72
+ title: str
73
+ """Title of the result"""
74
+ input_message_content: InputMessageContent
75
+ """Content of the message to be sent"""
76
+ reply_markup: InlineKeyboardMarkup | None = None
77
+ """Optional. Inline keyboard attached to the message"""
78
+ url: str | None = None
79
+ """Optional. URL of the result"""
80
+ description: str | None = None
81
+ """Optional. Short description of the result"""
82
+ thumbnail_url: str | None = None
83
+ """Optional. Url of the thumbnail for the result"""
84
+ thumbnail_width: int | None = None
85
+ """Optional. Thumbnail width"""
86
+ thumbnail_height: int | None = None
87
+ """Optional. Thumbnail height"""
88
+
89
+
90
+ @dataclass(kw_only=True, slots=True)
91
+ class InlineQueryResultPhoto(BotObject):
92
+ """Represents a link to a photo. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.
93
+
94
+ https://core.telegram.org/bots/api#inlinequeryresultphoto
95
+ """
96
+
97
+ type: str = 'photo'
98
+ """Type of the result, must be photo"""
99
+ id: str
100
+ """Unique identifier for this result, 1-64 bytes"""
101
+ photo_url: str
102
+ """A valid URL of the photo. Photo must be in JPEG format. Photo size must not exceed 5MB."""
103
+ thumbnail_url: str
104
+ """URL of the thumbnail for the photo"""
105
+ photo_width: int | None = None
106
+ """Optional. Width of the photo"""
107
+ photo_height: int | None = None
108
+ """Optional. Height of the photo"""
109
+ title: str | None = None
110
+ """Optional. Title for the result"""
111
+ description: str | None = None
112
+ """Optional. Short description of the result"""
113
+ caption: str | None = None
114
+ """Optional. Caption of the photo to be sent, 0-1024 characters after entities parsing"""
115
+ parse_mode: str | None = None
116
+ """Optional. Mode for parsing entities in the photo caption. See formatting options for more details."""
117
+ caption_entities: list[MessageEntity] | None = None
118
+ """Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode"""
119
+ show_caption_above_media: bool | None = None
120
+ """Optional. Pass True if the caption must be shown above the message media"""
121
+ reply_markup: InlineKeyboardMarkup | None = None
122
+ """Optional. Inline keyboard attached to the message"""
123
+ input_message_content: InputMessageContent | None = None
124
+ """Optional. Content of the message to be sent instead of the photo"""
@@ -0,0 +1,91 @@
1
+ from __future__ import annotations
2
+
3
+ from dataclasses import dataclass
4
+ from typing import TYPE_CHECKING
5
+
6
+ from ..core.base import BotObject
7
+
8
+ if TYPE_CHECKING:
9
+ from .available_types_04 import MessageEntity
10
+ from .available_types_21 import InlineKeyboardMarkup
11
+ from .unions_05 import InputMessageContent
12
+
13
+ __all__ = ['InlineQueryResultGif', 'InlineQueryResultMpeg4Gif']
14
+
15
+
16
+ @dataclass(kw_only=True, slots=True)
17
+ class InlineQueryResultGif(BotObject):
18
+ """Represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
19
+
20
+ https://core.telegram.org/bots/api#inlinequeryresultgif
21
+ """
22
+
23
+ type: str = 'gif'
24
+ """Type of the result, must be gif"""
25
+ id: str
26
+ """Unique identifier for this result, 1-64 bytes"""
27
+ gif_url: str
28
+ """A valid URL for the GIF file"""
29
+ gif_width: int | None = None
30
+ """Optional. Width of the GIF"""
31
+ gif_height: int | None = None
32
+ """Optional. Height of the GIF"""
33
+ gif_duration: int | None = None
34
+ """Optional. Duration of the GIF in seconds"""
35
+ thumbnail_url: str
36
+ """URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result"""
37
+ thumbnail_mime_type: str | None = None
38
+ """Optional. MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg”."""
39
+ title: str | None = None
40
+ """Optional. Title for the result"""
41
+ caption: str | None = None
42
+ """Optional. Caption of the GIF file to be sent, 0-1024 characters after entities parsing"""
43
+ parse_mode: str | None = None
44
+ """Optional. Mode for parsing entities in the caption. See formatting options for more details."""
45
+ caption_entities: list[MessageEntity] | None = None
46
+ """Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode"""
47
+ show_caption_above_media: bool | None = None
48
+ """Optional. Pass True if the caption must be shown above the message media"""
49
+ reply_markup: InlineKeyboardMarkup | None = None
50
+ """Optional. Inline keyboard attached to the message"""
51
+ input_message_content: InputMessageContent | None = None
52
+ """Optional. Content of the message to be sent instead of the GIF animation"""
53
+
54
+
55
+ @dataclass(kw_only=True, slots=True)
56
+ class InlineQueryResultMpeg4Gif(BotObject):
57
+ """Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, this animated MPEG-4 file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
58
+
59
+ https://core.telegram.org/bots/api#inlinequeryresultmpeg4gif
60
+ """
61
+
62
+ type: str = 'mpeg4_gif'
63
+ """Type of the result, must be mpeg4_gif"""
64
+ id: str
65
+ """Unique identifier for this result, 1-64 bytes"""
66
+ mpeg4_url: str
67
+ """A valid URL for the MPEG4 file"""
68
+ mpeg4_width: int | None = None
69
+ """Optional. Video width"""
70
+ mpeg4_height: int | None = None
71
+ """Optional. Video height"""
72
+ mpeg4_duration: int | None = None
73
+ """Optional. Video duration in seconds"""
74
+ thumbnail_url: str
75
+ """URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result"""
76
+ thumbnail_mime_type: str | None = None
77
+ """Optional. MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg”."""
78
+ title: str | None = None
79
+ """Optional. Title for the result"""
80
+ caption: str | None = None
81
+ """Optional. Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing"""
82
+ parse_mode: str | None = None
83
+ """Optional. Mode for parsing entities in the caption. See formatting options for more details."""
84
+ caption_entities: list[MessageEntity] | None = None
85
+ """Optional. List of special entities that appear in the caption, which can be specified instead of parse_mode"""
86
+ show_caption_above_media: bool | None = None
87
+ """Optional. Pass True if the caption must be shown above the message media"""
88
+ reply_markup: InlineKeyboardMarkup | None = None
89
+ """Optional. Inline keyboard attached to the message"""
90
+ input_message_content: InputMessageContent | None = None
91
+ """Optional. Content of the message to be sent instead of the video animation"""