closeGeneralForumTopic
Returns: TrueOfficial docs ↗
Use this method to close an open 'General' topic in a forum supergroup chat. The bot must be an administrator in the chat for this to work and must have the can_manage_topics administrator rights. Returns True on success.
Parameters
chat_idIntegerStringRequiredUnique identifier for the target chat or username of the target supergroup (in the format
@supergroupusername)Returns
On success, True is returned.
GramIO Usage
ts
// Close the General topic in a supergroup by username
await bot.api.closeGeneralForumTopic({
chat_id: "@mysupergroup",
});ts
// Admin command to close the General topic in the current chat
bot.command("closegeneral", async (ctx) => {
await bot.api.closeGeneralForumTopic({
chat_id: ctx.chatId,
});
await ctx.reply("The General topic has been closed.");
});ts
// Toggle: close General topic during off-hours, reopen in the morning
async function setGeneralTopicStatus(chatId: number, open: boolean) {
if (open) {
await bot.api.reopenGeneralForumTopic({ chat_id: chatId });
} else {
await bot.api.closeGeneralForumTopic({ chat_id: chatId });
}
}
// Close for the night
await setGeneralTopicStatus(-1001234567890, false);Errors
| Code | Error | Cause |
|---|---|---|
| 400 | Bad Request: chat not found | chat_id is invalid or the bot cannot access the chat |
| 400 | Bad Request: TOPIC_NOT_MODIFIED | The General topic is already closed |
| 403 | Forbidden: not enough rights | Bot is not an admin or lacks can_manage_topics permission |
| 400 | Bad Request: supergroup required | Forum topics only exist in supergroups with forum mode enabled |
Tips & Gotchas
- Only works in forum supergroups. The chat must be a supergroup with the forum mode feature enabled — not a regular group or channel.
- No topic creator exemption. Unlike
closeForumTopic, the General topic can only be closed by an admin with explicitcan_manage_topicsrights. Topic creator exemption does not apply here. - Hiding vs. closing. Closing prevents new messages.
hideGeneralForumTopichides the General topic from the topic list entirely, which is a separate operation. - Reopen with a dedicated method. Use
reopenGeneralForumTopicto allow messages again. A regularreopenForumTopicwon't work for the General topic.
See Also
reopenGeneralForumTopic— reopen the General topichideGeneralForumTopic— hide the General topic from the topic listcloseForumTopic— close any non-General topiccreateForumTopic— create new forum topicsdeleteForumTopic— permanently delete a forum topicForumTopic— the ForumTopic type