mirror of
https://github.com/aiogram/aiogram.git
synced 2026-04-08 16:37:47 +00:00
* Regenerate corresponding to Bot API 5.1 * Added base of FSM. Markup constructor and small refactoring * Fix dependencies * Fix mypy windows error * Move StatesGroup.get_root() from meta to class * Fixed chat and user constraints * Update pipeline * Remove docs pipeline * Added GLOBAL_USER FSM strategy * Reformat code * Fixed Dispatcher._process_update * Bump Bot API 5.2. Added integration with MagicFilter * Coverage
31 lines
1.4 KiB
Python
31 lines
1.4 KiB
Python
from __future__ import annotations
|
|
|
|
from typing import TYPE_CHECKING, Any, Dict, Optional, Union
|
|
|
|
from ..types import ChatInviteLink
|
|
from .base import Request, TelegramMethod
|
|
|
|
if TYPE_CHECKING: # pragma: no cover
|
|
from ..client.bot import Bot
|
|
|
|
|
|
class CreateChatInviteLink(TelegramMethod[ChatInviteLink]):
|
|
"""
|
|
Use this method to create an additional invite link for a chat. The bot must be an administrator in the chat for this to work and must have the appropriate admin rights. The link can be revoked using the method :class:`aiogram.methods.revoke_chat_invite_link.RevokeChatInviteLink`. Returns the new invite link as :class:`aiogram.types.chat_invite_link.ChatInviteLink` object.
|
|
|
|
Source: https://core.telegram.org/bots/api#createchatinvitelink
|
|
"""
|
|
|
|
__returning__ = ChatInviteLink
|
|
|
|
chat_id: Union[int, str]
|
|
"""Unique identifier for the target chat or username of the target channel (in the format :code:`@channelusername`)"""
|
|
expire_date: Optional[int] = None
|
|
"""Point in time (Unix timestamp) when the link will expire"""
|
|
member_limit: Optional[int] = None
|
|
"""Maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999"""
|
|
|
|
def build_request(self, bot: Bot) -> Request:
|
|
data: Dict[str, Any] = self.dict()
|
|
|
|
return Request(method="createChatInviteLink", data=data)
|