MadelineProto/docs/TD_docs/constructors/channel.md
2017-07-23 16:33:46 +02:00

2.7 KiB

title: channel description: Represents a channel with zero or more subscribers. There two different kinds of channels: supergroups and broadcast channels

Constructor: channel

Back to constructors index

Represents a channel with zero or more subscribers. There two different kinds of channels: supergroups and broadcast channels

Attributes:

Name Type Required Description
id int Yes Channel identifier
username string Yes Channel username, empty for private channels
date int Yes Date when current user has joined the channel or date when channel was created, if user is not a member. Unix time
status ChatMemberStatus Yes Status of the current user in the channel
anyone_can_invite Bool Yes True, if any member of the supergroup can invite other members. If the channel is not a supergroup, the field is meaningless
sign_messages Bool Yes True, if messages sent to the channel should content information about the sender. If the channel is a supergroup, the field is meaningless
is_supergroup Bool Yes True, if channel is a supergroup and is not a broadcast
is_verified Bool Yes True, if the channel is verified
restriction_reason string Yes If non-empty, contains the reason, why access to this channel must be restricted. Format of the string is "{type}: {description}".-{type} contains type of the restriction and at least one of the suffixes "-all", "-ios", "-android", "-wp", which describes platforms on which access should be restricted. For example, "terms-ios-android". {description} contains human-readable description of the restriction, which can be showed to the user

Type: Channel

Example:

$channel = ['_' => 'channel', 'id' => int, 'username' => 'string', 'date' => int, 'status' => ChatMemberStatus, 'anyone_can_invite' => Bool, 'sign_messages' => Bool, 'is_supergroup' => Bool, 'is_verified' => Bool, 'restriction_reason' => 'string'];

PWRTelegram json-encoded version:

{"_": "channel", "id": int, "username": "string", "date": int, "status": ChatMemberStatus, "anyone_can_invite": Bool, "sign_messages": Bool, "is_supergroup": Bool, "is_verified": Bool, "restriction_reason": "string"}

Or, if you're into Lua:

channel={_='channel', id=int, username='string', date=int, status=ChatMemberStatus, anyone_can_invite=Bool, sign_messages=Bool, is_supergroup=Bool, is_verified=Bool, restriction_reason='string'}