telegrinder 0.1.dev12__tar.gz → 0.1.dev14__tar.gz

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.

Potentially problematic release.


This version of telegrinder might be problematic. Click here for more details.

Files changed (74) hide show
  1. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/PKG-INFO +1 -1
  2. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/pyproject.toml +1 -1
  3. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/setup.py +1 -1
  4. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/__init__.py +1 -0
  5. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/api/abc.py +4 -0
  6. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/__init__.py +1 -1
  7. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/cute_types/message.py +7 -1
  8. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/dispatch/handler/func.py +2 -0
  9. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/scenario/__init__.py +1 -0
  10. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/scenario/checkbox.py +1 -3
  11. telegrinder-0.1.dev14/telegrinder/bot/scenario/choice.py +39 -0
  12. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/types/methods.py +88 -0
  13. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/types/objects.py +49 -0
  14. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/LICENSE +0 -0
  15. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/api/__init__.py +0 -0
  16. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/api/api.py +0 -0
  17. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/api/error.py +0 -0
  18. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/api/response.py +0 -0
  19. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/bot.py +0 -0
  20. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/cute_types/__init__.py +0 -0
  21. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/cute_types/callback_query.py +0 -0
  22. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/cute_types/inline_query.py +0 -0
  23. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/dispatch/__init__.py +0 -0
  24. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/dispatch/abc.py +0 -0
  25. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/dispatch/dispatch.py +0 -0
  26. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/dispatch/handler/__init__.py +0 -0
  27. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/dispatch/handler/abc.py +0 -0
  28. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/dispatch/middleware/__init__.py +0 -0
  29. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/dispatch/middleware/abc.py +0 -0
  30. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/dispatch/process.py +0 -0
  31. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/dispatch/view/__init__.py +0 -0
  32. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/dispatch/view/abc.py +0 -0
  33. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/dispatch/view/callback_query.py +0 -0
  34. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/dispatch/view/inline_query.py +0 -0
  35. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/dispatch/view/message.py +0 -0
  36. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/dispatch/waiter.py +0 -0
  37. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/polling/__init__.py +0 -0
  38. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/polling/abc.py +0 -0
  39. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/polling/polling.py +0 -0
  40. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/rules/__init__.py +0 -0
  41. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/rules/abc.py +0 -0
  42. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/rules/callback_data.py +0 -0
  43. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/rules/func.py +0 -0
  44. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/rules/fuzzy.py +0 -0
  45. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/rules/integer.py +0 -0
  46. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/rules/is_from.py +0 -0
  47. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/rules/markup.py +0 -0
  48. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/rules/regex.py +0 -0
  49. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/rules/text.py +0 -0
  50. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/bot/scenario/abc.py +0 -0
  51. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/client/__init__.py +0 -0
  52. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/client/abc.py +0 -0
  53. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/client/aiohttp.py +0 -0
  54. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/model.py +0 -0
  55. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/modules.py +0 -0
  56. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/result.py +0 -0
  57. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/rules.py +0 -0
  58. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/tools/__init__.py +0 -0
  59. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/tools/buttons.py +0 -0
  60. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/tools/formatting/__init__.py +0 -0
  61. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/tools/formatting/abc.py +0 -0
  62. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/tools/formatting/html.py +0 -0
  63. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/tools/formatting/markdown.py +0 -0
  64. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/tools/kb_set/__init__.py +0 -0
  65. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/tools/kb_set/base.py +0 -0
  66. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/tools/kb_set/yaml.py +0 -0
  67. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/tools/keyboard.py +0 -0
  68. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/tools/magic.py +0 -0
  69. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/tools/parse_mode.py +0 -0
  70. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/typegen/__init__.py +0 -0
  71. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/typegen/__main__.py +0 -0
  72. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/typegen/nicification.py +0 -0
  73. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/typegen/schema_generator.py +0 -0
  74. {telegrinder-0.1.dev12 → telegrinder-0.1.dev14}/telegrinder/types/__init__.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: telegrinder
3
- Version: 0.1.dev12
3
+ Version: 0.1.dev14
4
4
  Summary: async telegram bot building
5
5
  License: MIT
6
6
  Author: timoniq
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "telegrinder"
3
- version = "0.1.dev12"
3
+ version = "0.1.dev14"
4
4
  description = "async telegram bot building"
5
5
  authors = ["timoniq <tesseradecades@mail.ru>"]
6
6
  license = "MIT"
@@ -35,7 +35,7 @@ install_requires = \
35
35
 
36
36
  setup_kwargs = {
37
37
  'name': 'telegrinder',
38
- 'version': '0.1.dev12',
38
+ 'version': '0.1.dev14',
39
39
  'description': 'async telegram bot building',
40
40
  'long_description': 'None',
41
41
  'author': 'timoniq',
@@ -19,6 +19,7 @@ from .bot import (
19
19
  ABCMiddleware,
20
20
  ABCScenario,
21
21
  Checkbox,
22
+ SingleChoice,
22
23
  )
23
24
  from .tools import (
24
25
  Keyboard,
@@ -17,6 +17,10 @@ class Token(str):
17
17
  env.read_envfile()
18
18
  return cls(env.str(var_name))
19
19
 
20
+ @property
21
+ def bot_id(self) -> int:
22
+ return int(self.split(":")[0])
23
+
20
24
 
21
25
  class ABCAPI(ABC):
22
26
  http: ABCClient
@@ -12,4 +12,4 @@ from .dispatch import (
12
12
  from .bot import Telegrinder
13
13
  from .cute_types import MessageCute, CallbackQueryCute, InlineQueryCute
14
14
  from .rules import ABCRule, ABCMessageRule
15
- from .scenario import ABCScenario, Checkbox
15
+ from .scenario import ABCScenario, Checkbox, SingleChoice
@@ -40,6 +40,8 @@ class MessageCute(Message):
40
40
  **other
41
41
  ) -> Result["Message", APIError]:
42
42
  params = get_params(locals())
43
+ if "message_thread_id" not in params and self.is_topic_message:
44
+ params["message_thread_id"] = self.message_thread_id
43
45
  return await self.ctx_api.send_message(chat_id=self.chat.id, **params)
44
46
 
45
47
  async def reply(
@@ -62,6 +64,10 @@ class MessageCute(Message):
62
64
  **other
63
65
  ) -> Result["Message", APIError]:
64
66
  params = get_params(locals())
67
+ if "message_thread_id" not in params and self.is_topic_message:
68
+ params["message_thread_id"] = self.message_thread_id
65
69
  return await self.ctx_api.send_message(
66
- chat_id=self.chat.id, reply_to_message_id=self.message_id, **params
70
+ chat_id=self.chat.id,
71
+ reply_to_message_id=self.message_id,
72
+ **params
67
73
  )
@@ -5,6 +5,7 @@ from telegrinder.tools import magic_bundle
5
5
  from telegrinder.types import Update
6
6
  from telegrinder.api.abc import ABCAPI
7
7
  from .abc import ABCHandler
8
+ from telegrinder.modules import logger
8
9
 
9
10
  T = typing.TypeVar("T")
10
11
 
@@ -38,6 +39,7 @@ class FuncHandler(ABCHandler, typing.Generic[T]):
38
39
  api=api,
39
40
  )
40
41
  if not await rule.run_check(e, self.ctx):
42
+ logger.debug("Rule {} failed", rule)
41
43
  return False
42
44
  return True
43
45
 
@@ -1,2 +1,3 @@
1
1
  from .abc import ABCScenario
2
2
  from .checkbox import Checkbox
3
+ from .choice import SingleChoice
@@ -35,13 +35,11 @@ class Checkbox(ABCScenario):
35
35
  self,
36
36
  chat_id: int,
37
37
  msg: str,
38
- multiple_choice: bool = True,
39
38
  ready_text: str = "Ready",
40
39
  max_in_row: int = 3,
41
40
  ):
42
41
  self.chat_id = chat_id
43
42
  self.msg = msg
44
- self.multiple_choice = multiple_choice
45
43
  self.choices: typing.List[Choice] = []
46
44
  self.ready = ready_text
47
45
  self.max_in_row = max_in_row
@@ -100,7 +98,7 @@ class Checkbox(ABCScenario):
100
98
  assert len(self.choices) > 1
101
99
  message = (
102
100
  await api.send_message(
103
- self.chat_id, self.msg, self.PARSE_MODE, reply_markup=self.get_markup()
101
+ self.chat_id, text=self.msg, parse_mode=self.PARSE_MODE, reply_markup=self.get_markup()
104
102
  )
105
103
  ).unwrap()
106
104
  while True:
@@ -0,0 +1,39 @@
1
+ from .checkbox import Checkbox
2
+ from telegrinder.bot.cute_types import CallbackQueryCute
3
+ import typing
4
+
5
+ if typing.TYPE_CHECKING:
6
+ from telegrinder.api import API
7
+ from telegrinder.bot.dispatch import Dispatch
8
+
9
+
10
+ class SingleChoice(Checkbox):
11
+ async def handle(self, cb: CallbackQueryCute) -> bool:
12
+ code = cb.data.replace(self.random_code + "/", "", 1)
13
+
14
+ if code == "ready":
15
+ return False
16
+
17
+ for choice in self.choices:
18
+ choice.is_picked = False
19
+
20
+ for i, choice in enumerate(self.choices):
21
+ if choice.code == code:
22
+ self.choices[i].is_picked = True
23
+ await cb.ctx_api.edit_message_text(
24
+ cb.message.chat.id,
25
+ cb.message.message_id,
26
+ text=self.msg,
27
+ parse_mode=self.PARSE_MODE,
28
+ reply_markup=self.get_markup(),
29
+ )
30
+
31
+ return True
32
+
33
+ async def wait(
34
+ self, api: "API", dispatch: "Dispatch"
35
+ ) -> typing.Tuple[str, int]:
36
+ if len([choice for choice in self.choices if choice.is_picked]) != 1:
37
+ raise ValueError("Exactly one choice must be picked")
38
+ choices, m_id = await super().wait(api, dispatch)
39
+ return list(choices.keys())[list(choices.values()).index(True)], m_id
@@ -63,6 +63,7 @@ class APIMethods:
63
63
  async def send_message(
64
64
  self,
65
65
  chat_id: typing.Optional[typing.Union[int, str]] = None,
66
+ message_thread_id: typing.Optional[int] = None,
66
67
  text: typing.Optional[str] = None,
67
68
  parse_mode: typing.Optional[str] = None,
68
69
  entities: typing.Optional[typing.List[MessageEntity]] = None,
@@ -87,6 +88,7 @@ class APIMethods:
87
88
  async def forward_message(
88
89
  self,
89
90
  chat_id: typing.Optional[typing.Union[int, str]] = None,
91
+ message_thread_id: typing.Optional[int] = None,
90
92
  from_chat_id: typing.Optional[typing.Union[int, str]] = None,
91
93
  disable_notification: typing.Optional[bool] = None,
92
94
  protect_content: typing.Optional[bool] = None,
@@ -99,6 +101,7 @@ class APIMethods:
99
101
  async def copy_message(
100
102
  self,
101
103
  chat_id: typing.Optional[typing.Union[int, str]] = None,
104
+ message_thread_id: typing.Optional[int] = None,
102
105
  from_chat_id: typing.Optional[typing.Union[int, str]] = None,
103
106
  message_id: typing.Optional[int] = None,
104
107
  caption: typing.Optional[str] = None,
@@ -124,6 +127,7 @@ class APIMethods:
124
127
  async def send_photo(
125
128
  self,
126
129
  chat_id: typing.Optional[typing.Union[int, str]] = None,
130
+ message_thread_id: typing.Optional[int] = None,
127
131
  photo: typing.Optional[typing.Union[InputFile, str]] = None,
128
132
  caption: typing.Optional[str] = None,
129
133
  parse_mode: typing.Optional[str] = None,
@@ -148,6 +152,7 @@ class APIMethods:
148
152
  async def send_audio(
149
153
  self,
150
154
  chat_id: typing.Optional[typing.Union[int, str]] = None,
155
+ message_thread_id: typing.Optional[int] = None,
151
156
  audio: typing.Optional[typing.Union[InputFile, str]] = None,
152
157
  caption: typing.Optional[str] = None,
153
158
  parse_mode: typing.Optional[str] = None,
@@ -176,6 +181,7 @@ class APIMethods:
176
181
  async def send_document(
177
182
  self,
178
183
  chat_id: typing.Optional[typing.Union[int, str]] = None,
184
+ message_thread_id: typing.Optional[int] = None,
179
185
  document: typing.Optional[typing.Union[InputFile, str]] = None,
180
186
  thumb: typing.Optional[typing.Union[InputFile, str]] = None,
181
187
  caption: typing.Optional[str] = None,
@@ -202,6 +208,7 @@ class APIMethods:
202
208
  async def send_video(
203
209
  self,
204
210
  chat_id: typing.Optional[typing.Union[int, str]] = None,
211
+ message_thread_id: typing.Optional[int] = None,
205
212
  video: typing.Optional[typing.Union[InputFile, str]] = None,
206
213
  duration: typing.Optional[int] = None,
207
214
  width: typing.Optional[int] = None,
@@ -231,6 +238,7 @@ class APIMethods:
231
238
  async def send_animation(
232
239
  self,
233
240
  chat_id: typing.Optional[typing.Union[int, str]] = None,
241
+ message_thread_id: typing.Optional[int] = None,
234
242
  animation: typing.Optional[typing.Union[InputFile, str]] = None,
235
243
  duration: typing.Optional[int] = None,
236
244
  width: typing.Optional[int] = None,
@@ -259,6 +267,7 @@ class APIMethods:
259
267
  async def send_voice(
260
268
  self,
261
269
  chat_id: typing.Optional[typing.Union[int, str]] = None,
270
+ message_thread_id: typing.Optional[int] = None,
262
271
  voice: typing.Optional[typing.Union[InputFile, str]] = None,
263
272
  caption: typing.Optional[str] = None,
264
273
  parse_mode: typing.Optional[str] = None,
@@ -284,6 +293,7 @@ class APIMethods:
284
293
  async def send_video_note(
285
294
  self,
286
295
  chat_id: typing.Optional[typing.Union[int, str]] = None,
296
+ message_thread_id: typing.Optional[int] = None,
287
297
  video_note: typing.Optional[typing.Union[InputFile, str]] = None,
288
298
  duration: typing.Optional[int] = None,
289
299
  length: typing.Optional[int] = None,
@@ -308,6 +318,7 @@ class APIMethods:
308
318
  async def send_media_group(
309
319
  self,
310
320
  chat_id: typing.Optional[typing.Union[int, str]] = None,
321
+ message_thread_id: typing.Optional[int] = None,
311
322
  media: typing.Optional[
312
323
  typing.List[
313
324
  typing.Union[
@@ -330,6 +341,7 @@ class APIMethods:
330
341
  async def send_location(
331
342
  self,
332
343
  chat_id: typing.Optional[typing.Union[int, str]] = None,
344
+ message_thread_id: typing.Optional[int] = None,
333
345
  latitude: typing.Optional[float] = None,
334
346
  longitude: typing.Optional[float] = None,
335
347
  horizontal_accuracy: typing.Optional[float] = None,
@@ -387,6 +399,7 @@ class APIMethods:
387
399
  async def send_venue(
388
400
  self,
389
401
  chat_id: typing.Optional[typing.Union[int, str]] = None,
402
+ message_thread_id: typing.Optional[int] = None,
390
403
  latitude: typing.Optional[float] = None,
391
404
  longitude: typing.Optional[float] = None,
392
405
  title: typing.Optional[str] = None,
@@ -415,6 +428,7 @@ class APIMethods:
415
428
  async def send_contact(
416
429
  self,
417
430
  chat_id: typing.Optional[typing.Union[int, str]] = None,
431
+ message_thread_id: typing.Optional[int] = None,
418
432
  phone_number: typing.Optional[str] = None,
419
433
  first_name: typing.Optional[str] = None,
420
434
  last_name: typing.Optional[str] = None,
@@ -439,6 +453,7 @@ class APIMethods:
439
453
  async def send_poll(
440
454
  self,
441
455
  chat_id: typing.Optional[typing.Union[int, str]] = None,
456
+ message_thread_id: typing.Optional[int] = None,
442
457
  question: typing.Optional[str] = None,
443
458
  options: typing.Optional[typing.List[str]] = None,
444
459
  is_anonymous: typing.Optional[bool] = None,
@@ -471,6 +486,7 @@ class APIMethods:
471
486
  async def send_dice(
472
487
  self,
473
488
  chat_id: typing.Optional[typing.Union[int, str]] = None,
489
+ message_thread_id: typing.Optional[int] = None,
474
490
  emoji: typing.Optional[str] = None,
475
491
  disable_notification: typing.Optional[bool] = None,
476
492
  protect_content: typing.Optional[bool] = None,
@@ -563,6 +579,7 @@ class APIMethods:
563
579
  can_change_info: typing.Optional[bool] = None,
564
580
  can_invite_users: typing.Optional[bool] = None,
565
581
  can_pin_messages: typing.Optional[bool] = None,
582
+ can_manage_topics: typing.Optional[bool] = None,
566
583
  **other
567
584
  ) -> Result[bool, APIError]:
568
585
  result = await self.api.request_raw("promoteChatMember", get_params(locals()))
@@ -787,6 +804,74 @@ class APIMethods:
787
804
  )
788
805
  return full_result(result, bool)
789
806
 
807
+ async def get_forum_topic_icon_stickers(
808
+ self, **other
809
+ ) -> Result[typing.List[Sticker], APIError]:
810
+ result = await self.api.request_raw(
811
+ "getForumTopicIconStickers", get_params(locals())
812
+ )
813
+ return full_result(result, typing.List[Sticker])
814
+
815
+ async def create_forum_topic(
816
+ self,
817
+ chat_id: typing.Optional[typing.Union[int, str]] = None,
818
+ name: typing.Optional[str] = None,
819
+ icon_color: typing.Optional[int] = None,
820
+ icon_custom_emoji_id: typing.Optional[str] = None,
821
+ **other
822
+ ) -> Result[ForumTopic, APIError]:
823
+ result = await self.api.request_raw("createForumTopic", get_params(locals()))
824
+ return full_result(result, ForumTopic)
825
+
826
+ async def edit_forum_topic(
827
+ self,
828
+ chat_id: typing.Optional[typing.Union[int, str]] = None,
829
+ message_thread_id: typing.Optional[int] = None,
830
+ name: typing.Optional[str] = None,
831
+ icon_custom_emoji_id: typing.Optional[str] = None,
832
+ **other
833
+ ) -> Result[bool, APIError]:
834
+ result = await self.api.request_raw("editForumTopic", get_params(locals()))
835
+ return full_result(result, bool)
836
+
837
+ async def close_forum_topic(
838
+ self,
839
+ chat_id: typing.Optional[typing.Union[int, str]] = None,
840
+ message_thread_id: typing.Optional[int] = None,
841
+ **other
842
+ ) -> Result[bool, APIError]:
843
+ result = await self.api.request_raw("closeForumTopic", get_params(locals()))
844
+ return full_result(result, bool)
845
+
846
+ async def reopen_forum_topic(
847
+ self,
848
+ chat_id: typing.Optional[typing.Union[int, str]] = None,
849
+ message_thread_id: typing.Optional[int] = None,
850
+ **other
851
+ ) -> Result[bool, APIError]:
852
+ result = await self.api.request_raw("reopenForumTopic", get_params(locals()))
853
+ return full_result(result, bool)
854
+
855
+ async def delete_forum_topic(
856
+ self,
857
+ chat_id: typing.Optional[typing.Union[int, str]] = None,
858
+ message_thread_id: typing.Optional[int] = None,
859
+ **other
860
+ ) -> Result[bool, APIError]:
861
+ result = await self.api.request_raw("deleteForumTopic", get_params(locals()))
862
+ return full_result(result, bool)
863
+
864
+ async def unpin_all_forum_topic_messages(
865
+ self,
866
+ chat_id: typing.Optional[typing.Union[int, str]] = None,
867
+ message_thread_id: typing.Optional[int] = None,
868
+ **other
869
+ ) -> Result[bool, APIError]:
870
+ result = await self.api.request_raw(
871
+ "unpinAllForumTopicMessages", get_params(locals())
872
+ )
873
+ return full_result(result, bool)
874
+
790
875
  async def answer_callback_query(
791
876
  self,
792
877
  callback_query_id: typing.Optional[str] = None,
@@ -937,6 +1022,7 @@ class APIMethods:
937
1022
  async def send_sticker(
938
1023
  self,
939
1024
  chat_id: typing.Optional[typing.Union[int, str]] = None,
1025
+ message_thread_id: typing.Optional[int] = None,
940
1026
  sticker: typing.Optional[typing.Union[InputFile, str]] = None,
941
1027
  disable_notification: typing.Optional[bool] = None,
942
1028
  protect_content: typing.Optional[bool] = None,
@@ -1063,6 +1149,7 @@ class APIMethods:
1063
1149
  async def send_invoice(
1064
1150
  self,
1065
1151
  chat_id: typing.Optional[typing.Union[int, str]] = None,
1152
+ message_thread_id: typing.Optional[int] = None,
1066
1153
  title: typing.Optional[str] = None,
1067
1154
  description: typing.Optional[str] = None,
1068
1155
  payload: typing.Optional[str] = None,
@@ -1158,6 +1245,7 @@ class APIMethods:
1158
1245
  async def send_game(
1159
1246
  self,
1160
1247
  chat_id: typing.Optional[int] = None,
1248
+ message_thread_id: typing.Optional[int] = None,
1161
1249
  game_short_name: typing.Optional[str] = None,
1162
1250
  disable_notification: typing.Optional[bool] = None,
1163
1251
  protect_content: typing.Optional[bool] = None,
@@ -75,7 +75,10 @@ class Chat(Model):
75
75
  username: typing.Optional[str] = None
76
76
  first_name: typing.Optional[str] = None
77
77
  last_name: typing.Optional[str] = None
78
+ is_forum: typing.Optional[bool] = None
78
79
  photo: typing.Optional["ChatPhoto"] = None
80
+ active_usernames: typing.Optional[typing.List[str]] = None
81
+ emoji_status_custom_emoji_id: typing.Optional[str] = None
79
82
  bio: typing.Optional[str] = None
80
83
  has_private_forwards: typing.Optional[bool] = None
81
84
  has_restricted_voice_and_video_messages: typing.Optional[bool] = None
@@ -99,6 +102,7 @@ class Message(Model):
99
102
  Docs: https://core.telegram.org/bots/api/#message"""
100
103
 
101
104
  message_id: int
105
+ message_thread_id: typing.Optional[int] = None
102
106
  from_: typing.Optional["User"] = None
103
107
  sender_chat: typing.Optional["Chat"] = None
104
108
  date: int
@@ -109,6 +113,7 @@ class Message(Model):
109
113
  forward_signature: typing.Optional[str] = None
110
114
  forward_sender_name: typing.Optional[str] = None
111
115
  forward_date: typing.Optional[int] = None
116
+ is_topic_message: typing.Optional[bool] = None
112
117
  is_automatic_forward: typing.Optional[bool] = None
113
118
  reply_to_message: typing.Optional["Message"] = None
114
119
  via_bot: typing.Optional["User"] = None
@@ -153,6 +158,9 @@ class Message(Model):
153
158
  connected_website: typing.Optional[str] = None
154
159
  passport_data: typing.Optional["PassportData"] = None
155
160
  proximity_alert_triggered: typing.Optional["ProximityAlertTriggered"] = None
161
+ forum_topic_created: typing.Optional["ForumTopicCreated"] = None
162
+ forum_topic_closed: typing.Optional["ForumTopicClosed"] = None
163
+ forum_topic_reopened: typing.Optional["ForumTopicReopened"] = None
156
164
  video_chat_scheduled: typing.Optional["VideoChatScheduled"] = None
157
165
  video_chat_started: typing.Optional["VideoChatStarted"] = None
158
166
  video_chat_ended: typing.Optional["VideoChatEnded"] = None
@@ -398,6 +406,32 @@ class MessageAutoDeleteTimerChanged(Model):
398
406
  message_auto_delete_time: int
399
407
 
400
408
 
409
+ class ForumTopicCreated(Model):
410
+ """This object represents a service message about a new forum topic created
411
+ in the chat.
412
+ Docs: https://core.telegram.org/bots/api/#forumtopiccreated"""
413
+
414
+ name: str
415
+ icon_color: int
416
+ icon_custom_emoji_id: typing.Optional[str] = None
417
+
418
+
419
+ class ForumTopicClosed(Model):
420
+ """This object represents a service message about a forum topic closed in the
421
+ chat. Currently holds no information.
422
+ Docs: https://core.telegram.org/bots/api/#forumtopicclosed"""
423
+
424
+ pass
425
+
426
+
427
+ class ForumTopicReopened(Model):
428
+ """This object represents a service message about a forum topic reopened in
429
+ the chat. Currently holds no information.
430
+ Docs: https://core.telegram.org/bots/api/#forumtopicreopened"""
431
+
432
+ pass
433
+
434
+
401
435
  class VideoChatScheduled(Model):
402
436
  """This object represents a service message about a video chat scheduled in
403
437
  the chat.
@@ -625,6 +659,7 @@ class ChatAdministratorRights(Model):
625
659
  can_post_messages: typing.Optional[bool] = None
626
660
  can_edit_messages: typing.Optional[bool] = None
627
661
  can_pin_messages: typing.Optional[bool] = None
662
+ can_manage_topics: typing.Optional[bool] = None
628
663
 
629
664
 
630
665
  class ChatMember(Model):
@@ -660,6 +695,7 @@ class ChatMember(Model):
660
695
  can_post_messages: typing.Optional[bool] = None
661
696
  can_edit_messages: typing.Optional[bool] = None
662
697
  can_pin_messages: typing.Optional[bool] = None
698
+ can_manage_topics: typing.Optional[bool] = None
663
699
  is_member: typing.Optional[bool] = None
664
700
  can_send_messages: typing.Optional[bool] = None
665
701
  can_send_media_messages: typing.Optional[bool] = None
@@ -699,6 +735,7 @@ class ChatMemberAdministrator(Model):
699
735
  can_post_messages: typing.Optional[bool] = None
700
736
  can_edit_messages: typing.Optional[bool] = None
701
737
  can_pin_messages: typing.Optional[bool] = None
738
+ can_manage_topics: typing.Optional[bool] = None
702
739
  custom_title: typing.Optional[str] = None
703
740
 
704
741
 
@@ -722,6 +759,7 @@ class ChatMemberRestricted(Model):
722
759
  can_change_info: bool
723
760
  can_invite_users: bool
724
761
  can_pin_messages: bool
762
+ can_manage_topics: bool
725
763
  can_send_messages: bool
726
764
  can_send_media_messages: bool
727
765
  can_send_polls: bool
@@ -786,6 +824,7 @@ class ChatPermissions(Model):
786
824
  can_change_info: typing.Optional[bool] = None
787
825
  can_invite_users: typing.Optional[bool] = None
788
826
  can_pin_messages: typing.Optional[bool] = None
827
+ can_manage_topics: typing.Optional[bool] = None
789
828
 
790
829
 
791
830
  class ChatLocation(Model):
@@ -796,6 +835,16 @@ class ChatLocation(Model):
796
835
  address: str
797
836
 
798
837
 
838
+ class ForumTopic(Model):
839
+ """This object represents a forum topic.
840
+ Docs: https://core.telegram.org/bots/api/#forumtopic"""
841
+
842
+ message_thread_id: int
843
+ name: str
844
+ icon_color: int
845
+ icon_custom_emoji_id: typing.Optional[str] = None
846
+
847
+
799
848
  class BotCommand(Model):
800
849
  """This object represents a bot command.
801
850
  Docs: https://core.telegram.org/bots/api/#botcommand"""
File without changes