Discussion groups

Groups can be associated to a channel as a discussion group, to allow users to discuss about posts.

boolFalse#bc799737 = Bool;
boolTrue#997275b5 = Bool;

channelFull#f2355507 flags:# can_view_participants:flags.3?true can_set_username:flags.6?true can_set_stickers:flags.7?true hidden_prehistory:flags.10?true can_set_location:flags.16?true has_scheduled:flags.19?true can_view_stats:flags.20?true blocked:flags.22?true flags2:# can_delete_channel:flags2.0?true antispam:flags2.1?true participants_hidden:flags2.2?true translations_disabled:flags2.3?true id:long about:string participants_count:flags.0?int admins_count:flags.1?int kicked_count:flags.2?int banned_count:flags.2?int online_count:flags.13?int read_inbox_max_id:int read_outbox_max_id:int unread_count:int chat_photo:Photo notify_settings:PeerNotifySettings exported_invite:flags.23?ExportedChatInvite bot_info:Vector<BotInfo> migrated_from_chat_id:flags.4?long migrated_from_max_id:flags.4?int pinned_msg_id:flags.5?int stickerset:flags.8?StickerSet available_min_id:flags.9?int folder_id:flags.11?int linked_chat_id:flags.14?long location:flags.15?ChannelLocation slowmode_seconds:flags.17?int slowmode_next_send_date:flags.18?int stats_dc:flags.12?int pts:int call:flags.21?InputGroupCall ttl_period:flags.24?int pending_suggestions:flags.25?Vector<string> groupcall_default_join_as:flags.26?Peer theme_emoticon:flags.27?string requests_pending:flags.28?int recent_requesters:flags.28?Vector<long> default_send_as:flags.29?Peer available_reactions:flags.30?ChatReactions = ChatFull;

messages.chats#64ff9fd5 chats:Vector<Chat> = messages.Chats;

---functions---

channels.setDiscussionGroup#40582bb2 broadcast:InputChannel group:InputChannel = Bool;
channels.getGroupsForDiscussion#f5dad378 = messages.Chats;

A discussion group can be associated to a channel using channels.setDiscussionGroup.
The discussion group can be accessed in the client by clicking on the discuss button of the channel, or by accessing the comment section of a specific post; the discussion group ID is also present in the linked_chat_id field of the channelFull constructor.

All messages sent to the channel will also be sent to the linked group (with sender peer from_id equal to the peer of the linked channel); those messages will also be automatically pinned in the group.
The comment section of a particular post can be disabled by removing the channel post message from the discussion group.

Linking a discussion group

To obtain a list of admined supergroups that a channel admin can possibly associate to a channel, use channels.getGroupsForDiscussion.
Returned basic group chats must be first upgraded to supergroups before they can be set as a discussion group.
Before linking a supergroup to a channel, access to the supergroup's old messages must also be enabled using channels.togglePreHistoryHidden.

To set a returned supergroup as a discussion group use channels.setDiscussionGroup.

Schema:

boolFalse#bc799737 = Bool;
boolTrue#997275b5 = Bool;

messages.chats#64ff9fd5 chats:Vector<Chat> = messages.Chats;

---functions---

channels.setDiscussionGroup#40582bb2 broadcast:InputChannel group:InputChannel = Bool;
channels.getGroupsForDiscussion#f5dad378 = messages.Chats;

channels.togglePreHistoryHidden#eabbb94c channel:InputChannel enabled:Bool = Updates;

Requiring users to join the group

channel#83259464 flags:# creator:flags.0?true left:flags.2?true broadcast:flags.5?true verified:flags.7?true megagroup:flags.8?true restricted:flags.9?true signatures:flags.11?true min:flags.12?true scam:flags.19?true has_link:flags.20?true has_geo:flags.21?true slowmode_enabled:flags.22?true call_active:flags.23?true call_not_empty:flags.24?true fake:flags.25?true gigagroup:flags.26?true noforwards:flags.27?true join_to_send:flags.28?true join_request:flags.29?true forum:flags.30?true flags2:# id:long access_hash:flags.13?long title:string username:flags.6?string photo:ChatPhoto date:int restriction_reason:flags.9?Vector<RestrictionReason> admin_rights:flags.14?ChatAdminRights banned_rights:flags.15?ChatBannedRights default_banned_rights:flags.18?ChatBannedRights participants_count:flags.17?int usernames:flags2.0?Vector<Username> = Chat;

---functions---

channels.toggleJoinToSend#e4cb9580 channel:InputChannel enabled:Bool = Updates;

Admins may use channels.toggleJoinToSend to force users to join a discussion group before commenting.
The channel.join_to_send flag will be set accordingly, and all attempts by non-members to send a message to the group will return a CHAT_GUEST_SEND_FORBIDDEN RPC error.