ExportChatInviteRequest
Both users and bots can use this request. See code examples.
---functions--- messages.exportChatInvite#a455de90 flags:# legacy_revoke_permanent:flags.2?true request_needed:flags.3?true peer:InputPeer expire_date:flags.0?date usage_limit:flags.1?int title:flags.4?string subscription_pricing:flags.5?StarsSubscriptionPricing = ExportedChatInvite
Returns
| ExportedChatInvite |
This type can be an instance of either:
| ChatInviteExported | ChatInvitePublicJoinRequests |
Parameters
| peer | InputPeer | Anything entity-like will work if the library can find its Input version (e.g., usernames, Peer, User or Channel objects, etc.). |
| legacy_revoke_permanent | flag | This argument defaults to None and can be omitted. |
| request_needed | flag | This argument defaults to None and can be omitted. |
| expire_date | date | This argument defaults to None and can be omitted. |
| usage_limit | int | This argument defaults to None and can be omitted. |
| title | string | This argument defaults to None and can be omitted. |
| subscription_pricing | StarsSubscriptionPricing | This argument defaults to None and can be omitted. |
Known RPC errors
This request can cause 2 known errors:
ChatIdInvalidError | Invalid object ID for a chat. Make sure to pass the right types, for instance making sure that the request is designed for chats (not channels/megagroups) or otherwise look for a different one more suited\nAn example working with a megagroup and AddChatUserRequest, it will fail because megagroups are channels. Use InviteToChannelRequest instead. |
ExpireDateInvalidError | The specified expiration date is invalid. |
You can import these from telethon.errors.
Example
from telethon.sync import TelegramClient
from telethon import functions, types
with TelegramClient(name, api_id, api_hash) as client:
result = client(functions.messages.ExportChatInviteRequest(
peer='username',
legacy_revoke_permanent=True,
request_needed=True,
expire_date=datetime.datetime(2018, 6, 25),
usage_limit=42,
title='My awesome title',
subscription_pricing=types.StarsSubscriptionPricing(
period=42,
amount=-12398745604826
)
))
print(result.stringify())