mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
kick_chat_member refactored + docs update
This commit is contained in:
parent
87af60a16d
commit
7d522690cc
1 changed files with 21 additions and 13 deletions
|
|
@ -1550,28 +1550,36 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
|
||||||
result = await self.request(api.Methods.GET_FILE, payload)
|
result = await self.request(api.Methods.GET_FILE, payload)
|
||||||
return types.File(**result)
|
return types.File(**result)
|
||||||
|
|
||||||
async def kick_chat_member(self, chat_id: typing.Union[base.Integer, base.String], user_id: base.Integer,
|
async def kick_chat_member(self,
|
||||||
until_date: typing.Union[
|
chat_id: typing.Union[base.Integer, base.String],
|
||||||
base.Integer, datetime.datetime, datetime.timedelta, None] = None) -> base.Boolean:
|
user_id: base.Integer,
|
||||||
|
until_date: typing.Union[base.Integer, datetime.datetime,
|
||||||
|
datetime.timedelta, None] = None,
|
||||||
|
) -> base.Boolean:
|
||||||
"""
|
"""
|
||||||
Use this method to kick a user from a group, a supergroup or a channel.
|
Use this method to kick a user from a group, a supergroup or a channel.
|
||||||
In the case of supergroups and channels, the user will not be able to return to the group
|
In the case of supergroups and channels, the user will not be able to return
|
||||||
on their own using invite links, etc., unless unbanned first.
|
to the chat on their own using invite links, etc., unless unbanned first.
|
||||||
|
|
||||||
The bot must be an administrator in the chat for this to work and must have the appropriate admin rights.
|
The bot must be an administrator in the chat for this to work and must have
|
||||||
|
the appropriate admin rights.
|
||||||
Note: In regular groups (non-supergroups), this method will only work if the ‘All Members Are Admins’ setting
|
|
||||||
is off in the target group.
|
|
||||||
Otherwise members may only be removed by the group's creator or by the member that added them.
|
|
||||||
|
|
||||||
Source: https://core.telegram.org/bots/api#kickchatmember
|
Source: https://core.telegram.org/bots/api#kickchatmember
|
||||||
|
|
||||||
:param chat_id: Unique identifier for the target group or username of the target supergroup or channel
|
:param chat_id: Unique identifier for the target group or username of the
|
||||||
|
target supergroup or channel (in the format @channelusername)
|
||||||
:type chat_id: :obj:`typing.Union[base.Integer, base.String]`
|
:type chat_id: :obj:`typing.Union[base.Integer, base.String]`
|
||||||
|
|
||||||
:param user_id: Unique identifier of the target user
|
:param user_id: Unique identifier of the target user
|
||||||
:type user_id: :obj:`base.Integer`
|
:type user_id: :obj:`base.Integer`
|
||||||
:param until_date: Date when the user will be unbanned, unix time
|
|
||||||
:type until_date: :obj:`typing.Optional[base.Integer]`
|
:param until_date: Date when the user will be unbanned. If user is banned
|
||||||
|
for more than 366 days or less than 30 seconds from the current time they
|
||||||
|
are considered to be banned forever. Applied for supergroups and channels
|
||||||
|
only.
|
||||||
|
:type until_date: :obj:`typing.Union[base.Integer, datetime.datetime,
|
||||||
|
datetime.timedelta, None`
|
||||||
|
|
||||||
:return: Returns True on success
|
:return: Returns True on success
|
||||||
:rtype: :obj:`base.Boolean`
|
:rtype: :obj:`base.Boolean`
|
||||||
"""
|
"""
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue