mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
feat: add shortcuts
Added Chat.ban_sender_chat() and Chat.unban_sender_chat() shortcuts.
This commit is contained in:
parent
240fcc3771
commit
a5739a8dd2
1 changed files with 24 additions and 0 deletions
|
|
@ -623,6 +623,30 @@ class Chat(base.TelegramObject):
|
|||
message_id=message_id,
|
||||
)
|
||||
|
||||
async def ban_sender_chat(
|
||||
self,
|
||||
sender_chat_id: base.Integer,
|
||||
until_date: typing.Union[
|
||||
base.Integer, datetime.datetime, datetime.timedelta, None
|
||||
] = None,
|
||||
):
|
||||
"""Shortcut for banChatSenderChat method."""
|
||||
return await self.bot.ban_chat_sender_chat(
|
||||
chat_id=self.id,
|
||||
sender_chat_id=sender_chat_id,
|
||||
until_date=until_date,
|
||||
)
|
||||
|
||||
async def unban_sender_chat(
|
||||
self,
|
||||
sender_chat_id: base.Integer,
|
||||
):
|
||||
"""Shortcut for unbanChatSenderChat method."""
|
||||
return await self.bot.unban_chat_sender_chat(
|
||||
chat_id=self.id,
|
||||
sender_chat_id=sender_chat_id,
|
||||
)
|
||||
|
||||
def __int__(self):
|
||||
return self.id
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue