set_chat_discussion_group()

async Client.set_chat_discussion_group()

Link or unlink a discussion group to a channel.

Requires the can_change_info administrator right in the channel, and the can_pin_messages member right in the group.

Usable by Users Bots
Parameters:
  • chat_id (int | str, optional) – Unique identifier (int) or username (str) of the target channel. Pass None to unlink the group given in discussion_chat_id from its channel.

  • discussion_chat_id (int | str, optional) – Unique identifier (int) or username (str) of the discussion group. Pass None to remove the current discussion group of the channel.

Returns:

bool – On success, True is returned.

Raises:

ValueError – In case both arguments are None, or one of them does not belong to a channel.

Example

await app.set_chat_discussion_group("@channel", "@group")

await app.set_chat_discussion_group(chat_id="@channel")