Groosha 2021-12-07 20:44:24 +03:00
parent 24a805d517
commit 3537a469f3
4 changed files with 72 additions and 0 deletions

View file

@ -0,0 +1,34 @@
from __future__ import annotations
import datetime
from typing import TYPE_CHECKING, Any, Dict, Optional, Union
from .base import Request, TelegramMethod
if TYPE_CHECKING:
from ..client.bot import Bot
class BanChatSenderChat(TelegramMethod[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 first. The bot must be an administrator in the supergroup or channel
for this to work and must have the appropriate administrator rights. Returns True on success.
Source: https://core.telegram.org/bots/api#banchatsenderchat
"""
__returning__ = bool
chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername)`"""
sender_chat_id: int
"""Unique identifier of the target sender chat"""
until_date: Optional[Union[datetime.datetime, datetime.timedelta, int]] = None
"""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."""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict()
return Request(method="banChatSenderChat", data=data)

View file

@ -0,0 +1,30 @@
from __future__ import annotations
from typing import TYPE_CHECKING, Any, Dict, Union
from .base import Request, TelegramMethod
if TYPE_CHECKING:
from ..client.bot import Bot
class UnbanChatSenderChat(TelegramMethod[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 True on success.
Source: https://core.telegram.org/bots/api#unbanchatsenderchat
"""
__returning__ = bool
chat_id: Union[int, str]
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername)`"""
sender_chat_id: int
"""Unique identifier of the target sender chat"""
def build_request(self, bot: Bot) -> Request:
data: Dict[str, Any] = self.dict()
return Request(method="unbanChatSenderChat", data=data)

View file

@ -34,6 +34,8 @@ class Chat(TelegramObject):
"""*Optional*. Chat photo. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
bio: Optional[str] = None
"""*Optional*. Bio of the other party in a private chat. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
has_private_forwards: Optional[bool] = None
"""*Optional*. True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
description: Optional[str] = None
"""*Optional*. Description, for groups, supergroups and channel chats. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
invite_link: Optional[str] = None
@ -46,6 +48,8 @@ class Chat(TelegramObject):
"""*Optional*. For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user; in seconds. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
message_auto_delete_time: Optional[int] = None
"""*Optional*. The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
has_protected_content: Optional[bool] = None
"""*Optional*. True, if messages from the chat can't be forwarded to other chats. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
sticker_set_name: Optional[str] = None
"""*Optional*. For supergroups, name of group sticker set. Returned only in :class:`aiogram.methods.get_chat.GetChat`."""
can_set_sticker_set: Optional[bool] = None

View file

@ -100,12 +100,16 @@ class Message(TelegramObject):
"""*Optional*. Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages"""
forward_date: Optional[int] = None
"""*Optional*. For forwarded messages, date the original message was sent in Unix time"""
is_automatic_forward: Optional[bool] = None
"""*Optional*. True, if the message is a channel post that was automatically forwarded to the connected discussion group"""
reply_to_message: Optional[Message] = None
"""*Optional*. For replies, the original message. Note that the Message object in this field will not contain further *reply_to_message* fields even if it itself is a reply."""
via_bot: Optional[User] = None
"""*Optional*. Bot through which the message was sent"""
edit_date: Optional[int] = None
"""*Optional*. Date the message was last edited in Unix time"""
has_protected_content: Optional[bool] = None
"""*Optional*. True, if the message can't be forwarded"""
media_group_id: Optional[str] = None
"""*Optional*. The unique identifier of a media message group this message belongs to"""
author_signature: Optional[str] = None