mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
Fix typing for until_date argument (can be datetime or timedelta)
This commit is contained in:
parent
f03e2169c3
commit
cb4f459597
2 changed files with 8 additions and 4 deletions
|
|
@ -1,5 +1,6 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
|
import datetime
|
||||||
import typing
|
import typing
|
||||||
import warnings
|
import warnings
|
||||||
|
|
||||||
|
|
@ -963,7 +964,8 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
|
||||||
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, chat_id: typing.Union[base.Integer, base.String], user_id: base.Integer,
|
||||||
until_date: typing.Union[base.Integer, None] = None) -> base.Boolean:
|
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 to the group
|
||||||
|
|
@ -1018,7 +1020,8 @@ class Bot(BaseBot, DataMixin, ContextInstanceMixin):
|
||||||
user_id: base.Integer,
|
user_id: base.Integer,
|
||||||
permissions: typing.Optional[types.ChatPermissions] = None,
|
permissions: typing.Optional[types.ChatPermissions] = None,
|
||||||
# permissions argument need to be required after removing other `can_*` arguments
|
# permissions argument need to be required after removing other `can_*` arguments
|
||||||
until_date: typing.Union[base.Integer, None] = None,
|
until_date: typing.Union[
|
||||||
|
base.Integer, datetime.datetime, datetime.timedelta, None] = None,
|
||||||
can_send_messages: typing.Union[base.Boolean, None] = None,
|
can_send_messages: typing.Union[base.Boolean, None] = None,
|
||||||
can_send_media_messages: typing.Union[base.Boolean, None] = None,
|
can_send_media_messages: typing.Union[base.Boolean, None] = None,
|
||||||
can_send_other_messages: typing.Union[base.Boolean, None] = None,
|
can_send_other_messages: typing.Union[base.Boolean, None] = None,
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,7 @@
|
||||||
from __future__ import annotations
|
from __future__ import annotations
|
||||||
|
|
||||||
import asyncio
|
import asyncio
|
||||||
|
import datetime
|
||||||
import typing
|
import typing
|
||||||
|
|
||||||
from . import base
|
from . import base
|
||||||
|
|
@ -164,7 +165,7 @@ class Chat(base.TelegramObject):
|
||||||
return await self.bot.delete_chat_description(self.id, description)
|
return await self.bot.delete_chat_description(self.id, description)
|
||||||
|
|
||||||
async def kick(self, user_id: base.Integer,
|
async def kick(self, user_id: base.Integer,
|
||||||
until_date: typing.Union[base.Integer, None] = None):
|
until_date: typing.Union[base.Integer, datetime.datetime, datetime.timedelta, None] = None):
|
||||||
"""
|
"""
|
||||||
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 to the group
|
||||||
|
|
@ -205,7 +206,7 @@ class Chat(base.TelegramObject):
|
||||||
|
|
||||||
async def restrict(self, user_id: base.Integer,
|
async def restrict(self, user_id: base.Integer,
|
||||||
permissions: typing.Optional[ChatPermissions] = None,
|
permissions: typing.Optional[ChatPermissions] = None,
|
||||||
until_date: typing.Union[base.Integer, None] = None,
|
until_date: typing.Union[base.Integer, datetime.datetime, datetime.timedelta, None] = None,
|
||||||
can_send_messages: typing.Union[base.Boolean, None] = None,
|
can_send_messages: typing.Union[base.Boolean, None] = None,
|
||||||
can_send_media_messages: typing.Union[base.Boolean, None] = None,
|
can_send_media_messages: typing.Union[base.Boolean, None] = None,
|
||||||
can_send_other_messages: typing.Union[base.Boolean, None] = None,
|
can_send_other_messages: typing.Union[base.Boolean, None] = None,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue