CreateChatRequest
Only users can use this request. See code examples.
---functions--- messages.createChat#92ceddd4 flags:# users:Vector<InputUser> title:string ttl_period:flags.0?int = messages.InvitedUsers
Returns
| messages.InvitedUsers |
This type can only be an instance of:
| InvitedUsers |
Parameters
| users | InputUser | Anything entity-like will work if the library can find its Input version (e.g., usernames, Peer, User or Channel objects, etc.). A list must be supplied. |
| title | string | |
| ttl_period | int | This argument defaults to None and can be omitted. |
Known RPC errors
This request can cause 2 known errors:
UsersTooFewError | Not enough users (to create a chat, for example). |
UserRestrictedError | You're spamreported, you can't create channels or chats.. |
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.CreateChatRequest(
users=['username'],
title='My awesome title',
ttl_period=42
))
print(result.stringify())