mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Added missing types and methods
This commit is contained in:
parent
3537a469f3
commit
12704b57b0
2 changed files with 53 additions and 0 deletions
|
|
@ -29,6 +29,7 @@ from ..methods import (
|
|||
AnswerShippingQuery,
|
||||
ApproveChatJoinRequest,
|
||||
BanChatMember,
|
||||
BanChatSenderChat,
|
||||
Close,
|
||||
CopyMessage,
|
||||
CreateChatInviteLink,
|
||||
|
|
@ -102,6 +103,7 @@ from ..methods import (
|
|||
StopPoll,
|
||||
TelegramMethod,
|
||||
UnbanChatMember,
|
||||
UnbanChatSenderChat,
|
||||
UnpinAllChatMessages,
|
||||
UnpinChatMessage,
|
||||
UploadStickerFile,
|
||||
|
|
@ -1470,6 +1472,31 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
)
|
||||
return await self(call, request_timeout=request_timeout)
|
||||
|
||||
async def ban_chat_sender_chat(
|
||||
self,
|
||||
chat_id: Union[int, str],
|
||||
sender_chat_id: int,
|
||||
until_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None,
|
||||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to ban a channel chat in a supergroup or a channel. The owner of the chat will not be able to send messages and join live streams on behalf of the chat, unless it is `unbanned <https://core.telegram.org/bots/api#unbanchatmember>`_ first. The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#banchatsenderchat
|
||||
|
||||
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)
|
||||
:param sender_chat_id: Unique identifier of the target sender chat
|
||||
:param until_date: Date when the sender chat will be unbanned, unix time. If the chat is banned for more than 366 days or less than 30 seconds from the current time they are considered to be banned forever.
|
||||
:param request_timeout: Request timeout
|
||||
:return: Returns True on success.
|
||||
"""
|
||||
call = BanChatSenderChat(
|
||||
chat_id=chat_id,
|
||||
sender_chat_id=sender_chat_id,
|
||||
until_date=until_date,
|
||||
)
|
||||
return await self(call, request_timeout=request_timeout)
|
||||
|
||||
async def kick_chat_member(
|
||||
self,
|
||||
chat_id: Union[int, str],
|
||||
|
|
@ -1529,6 +1556,28 @@ class Bot(ContextInstanceMixin["Bot"]):
|
|||
)
|
||||
return await self(call, request_timeout=request_timeout)
|
||||
|
||||
async def unban_chat_sender_chat(
|
||||
self,
|
||||
chat_id: Union[int, str],
|
||||
sender_chat_id: int,
|
||||
request_timeout: Optional[int] = None,
|
||||
) -> bool:
|
||||
"""
|
||||
Use this method to unban a previously banned channel chat in a supergroup or channel. The bot must be an administrator for this to work and must have the appropriate administrator rights. Returns :code:`True` on success.
|
||||
|
||||
Source: https://core.telegram.org/bots/api#unbanchatsenderchat
|
||||
|
||||
:param chat_id: Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)
|
||||
:param sender_chat_id: Unique identifier of the target sender chat
|
||||
:param request_timeout: Request timeout
|
||||
:return: Returns True on success.
|
||||
"""
|
||||
call = UnbanChatSenderChat(
|
||||
chat_id=chat_id,
|
||||
sender_chat_id=sender_chat_id,
|
||||
)
|
||||
return await self(call, request_timeout=request_timeout)
|
||||
|
||||
async def restrict_chat_member(
|
||||
self,
|
||||
chat_id: Union[int, str],
|
||||
|
|
|
|||
|
|
@ -5,6 +5,7 @@ from .answer_pre_checkout_query import AnswerPreCheckoutQuery
|
|||
from .answer_shipping_query import AnswerShippingQuery
|
||||
from .approve_chat_join_request import ApproveChatJoinRequest
|
||||
from .ban_chat_member import BanChatMember
|
||||
from .ban_chat_sender_chat import BanChatSenderChat
|
||||
from .base import Request, Response, TelegramMethod
|
||||
from .close import Close
|
||||
from .copy_message import CopyMessage
|
||||
|
|
@ -78,6 +79,7 @@ from .set_webhook import SetWebhook
|
|||
from .stop_message_live_location import StopMessageLiveLocation
|
||||
from .stop_poll import StopPoll
|
||||
from .unban_chat_member import UnbanChatMember
|
||||
from .unban_chat_sender_chat import UnbanChatSenderChat
|
||||
from .unpin_all_chat_messages import UnpinAllChatMessages
|
||||
from .unpin_chat_message import UnpinChatMessage
|
||||
from .upload_sticker_file import UploadStickerFile
|
||||
|
|
@ -115,8 +117,10 @@ __all__ = (
|
|||
"GetUserProfilePhotos",
|
||||
"GetFile",
|
||||
"BanChatMember",
|
||||
"BanChatSenderChat",
|
||||
"KickChatMember",
|
||||
"UnbanChatMember",
|
||||
"UnbanChatSenderChat",
|
||||
"RestrictChatMember",
|
||||
"PromoteChatMember",
|
||||
"SetChatAdministratorCustomTitle",
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue