Skip to content

Commit d047332

Browse files
committed
Minor changes
1 parent eca1fba commit d047332

File tree

3 files changed

+74
-9
lines changed

3 files changed

+74
-9
lines changed

setup.cfg

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[metadata]
22
name = telegrambots-custom
3-
version = 0.0.7rc1
3+
version = 0.0.7rc2
44
author = immmdreza
55
author_email = ir310022@gmail.com
66
description = A custom extension packages for telegrambots.

src/telegrambots/custom/contexts/_contexts/message_context.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,12 @@ def __init__(
2727
) -> None:
2828
super().__init__(dp, update, Message, handler_tag, *args, **kwargs)
2929

30+
@final
31+
@property
32+
def message_id(self) -> int:
33+
"""Returns the message id"""
34+
return self.update.message_id
35+
3036
@property
3137
@final
3238
def sender(self):

src/telegrambots/custom/extensions/context.py

Lines changed: 67 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -115,9 +115,9 @@ def decorator(
115115
[self._context.handler_tag] + (other_continue_with or []),
116116
allow_continue_after_self,
117117
)
118-
self._context.continue_with.callback_query(
118+
self._context.continue_with.callback_query_from(
119119
_tag,
120-
[CallbackQuerySenderId(user_id)],
120+
user_id,
121121
0,
122122
include_ctx_data,
123123
*args,
@@ -150,9 +150,10 @@ def decorator(
150150
[self._context.handler_tag] + (other_continue_with or []),
151151
allow_continue_after_self,
152152
)
153-
self._context.continue_with.callback_query(
153+
self._context.continue_with.callback_query_same_message_from(
154154
_tag,
155-
[CallbackQuerySenderId(user_id), CallbackQueryMessageId(message_id)],
155+
message_id,
156+
user_id,
156157
0,
157158
include_ctx_data,
158159
*args,
@@ -184,9 +185,9 @@ def decorator(
184185
[self._context.handler_tag] + (other_continue_with or []),
185186
allow_continue_after_self,
186187
)
187-
self._context.continue_with.callback_query(
188+
self._context.continue_with.callback_query_same_message(
188189
_tag,
189-
[CallbackQueryMessageId(message_id)],
190+
message_id,
190191
0,
191192
include_ctx_data,
192193
*args,
@@ -253,8 +254,8 @@ def decorator(
253254
allow_continue_after_self,
254255
)
255256
self._context.continue_with.message_from(
256-
user_id,
257257
_tag,
258+
user_id,
258259
0,
259260
include_ctx_data,
260261
*args,
@@ -394,8 +395,8 @@ def message(
394395

395396
def message_from(
396397
self,
397-
user_id: int,
398398
target_tag: str,
399+
user_id: int,
399400
priority: int = 0,
400401
include_ctx_data: bool = True,
401402
*args: Any,
@@ -430,6 +431,64 @@ def callback_query(
430431
**kwargs,
431432
)
432433

434+
def callback_query_from(
435+
self,
436+
target_tag: str,
437+
user_id: int,
438+
priority: int = 0,
439+
include_ctx_data: bool = True,
440+
*args: Any,
441+
**kwargs: Any,
442+
) -> NoReturn:
443+
self.any(
444+
target_tag,
445+
CallbackQuery,
446+
[CallbackQuerySenderId(user_id)],
447+
priority,
448+
include_ctx_data,
449+
*args,
450+
**kwargs,
451+
)
452+
453+
def callback_query_same_message_from(
454+
self,
455+
target_tag: str,
456+
message_id: int,
457+
user_id: int,
458+
priority: int = 0,
459+
include_ctx_data: bool = True,
460+
*args: Any,
461+
**kwargs: Any,
462+
) -> NoReturn:
463+
self.any(
464+
target_tag,
465+
CallbackQuery,
466+
[CallbackQuerySenderId(user_id), CallbackQueryMessageId(message_id)],
467+
priority,
468+
include_ctx_data,
469+
*args,
470+
**kwargs,
471+
)
472+
473+
def callback_query_same_message(
474+
self,
475+
target_tag: str,
476+
message_id: int,
477+
priority: int = 0,
478+
include_ctx_data: bool = True,
479+
*args: Any,
480+
**kwargs: Any,
481+
) -> NoReturn:
482+
self.any(
483+
target_tag,
484+
CallbackQuery,
485+
[CallbackQueryMessageId(message_id)],
486+
priority,
487+
include_ctx_data,
488+
*args,
489+
**kwargs,
490+
)
491+
433492
def self(
434493
self,
435494
keys: Sequence[AbstractKeyResolver[CallbackQuery, Any]],

0 commit comments

Comments
 (0)