set_chat_discussion_group()

Client.set_chat_discussion_group()

Change the discussion group of a channel chat.

Requires can_change_info administrator right in the channel if it is specified.

Usable by Users Bots
Parameters:
  • chat_id (int | str, optional) – Unique identifier (int) or username (str) of the target chat. Pass None to remove a link from the supergroup passed in the second argument to a linked channel chat (requires can_pin_messages member right in the supergroup)

  • discussion_chat_id (int | str, optional) – Unique identifier (int) or username (str) of a new channel’s discussion group. Use the method get_suitable_discussion_chats() to find all suitable groups. Pass None to remove the discussion group.

Returns:

bool – True on success.

Raises:

ValueError – In case a chat id or discussion chat id belongs to a user.

Example

# Set a discussion group for a channel
await app.set_chat_discussion_group(chat_id="@pyrogram", discussion_chat_id="@pyrogramchat")

# Remove a discussion group from a channel
await app.set_chat_discussion_group(chat_id="@pyrogram")

# Remove a discussion group from a channel
await app.set_chat_discussion_group(discussion_chat_id="@pyrogramchat")