CreateChannelRequest
Only users can use this request. See code examples.
---functions--- channels.createChannel#91006707 flags:# broadcast:flags.0?true megagroup:flags.1?true for_import:flags.3?true forum:flags.5?true title:string about:string geo_point:flags.2?InputGeoPoint address:flags.2?string ttl_period:flags.4?int = Updates
Returns
Updates |
This type can be an instance of either:
UpdateShort | UpdateShortChatMessage |
UpdateShortMessage | UpdateShortSentMessage |
Updates | UpdatesCombined |
UpdatesTooLong |
Parameters
title | string | |
about | string | |
broadcast | flag | This argument defaults to None and can be omitted. |
megagroup | flag | This argument defaults to None and can be omitted. |
for_import | flag | This argument defaults to None and can be omitted. |
forum | flag | This argument defaults to None and can be omitted. |
geo_point | InputGeoPoint | This argument defaults to None and can be omitted. |
address | string | This argument defaults to None and can be omitted. |
ttl_period | int | This argument defaults to None and can be omitted. |
Known RPC errors
This request can cause 2 known errors:
ChatTitleEmptyError | No chat title provided. |
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.channels.CreateChannelRequest( title='My awesome title', about='some string here', megagroup=True, for_import=True, forum=True, geo_point=types.InputGeoPoint( lat=7.13, long=7.13, accuracy_radius=42 ), address='some string here', ttl_period=42 )) print(result.stringify())