editGeneralForumTopic
Returns: TrueOfficial docs ↗
Use this method to edit the name of the '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)nameStringRequiredminLen 1maxLen 128New topic name, 1-128 characters
Returns
On success, True is returned.
GramIO Usage
ts
// Rename the General topic
await bot.api.editGeneralForumTopic({
chat_id: -1001234567890,
name: "Welcome & Announcements",
});ts
// Rename by username — works for public supergroups
await bot.api.editGeneralForumTopic({
chat_id: "@mysupergroup",
name: "General Chat",
});ts
// Restore the default name after a custom rename
bot.command("reset_general", async (ctx) => {
await bot.api.editGeneralForumTopic({
chat_id: ctx.chat.id,
name: "General",
});
await ctx.send("General topic name has been reset.");
});Errors
| Code | Error | Cause |
|---|---|---|
| 400 | Bad Request: chat not found | Invalid chat_id or the bot is not a member of the chat |
| 400 | Bad Request: method is available only in supergroups | Target chat is not a forum supergroup — forums must be enabled in the group settings |
| 400 | Bad Request: not enough rights to manage topics | Bot lacks the can_manage_topics administrator right |
| 400 | Bad Request: TOPIC_NAME_INVALID | name is empty or exceeds 128 characters |
| 403 | Forbidden: not enough rights | Bot is not an administrator in the supergroup |
| 429 | Too Many Requests: retry after N | Rate limit hit — check retry_after, use auto-retry plugin |
TIP
Use GramIO's auto-retry plugin to handle 429 errors automatically.
Tips & Gotchas
- The General topic has its own dedicated method. Unlike regular topics, the General topic cannot be edited with
editForumTopic— use this method instead. nameis required and must be 1–128 characters. Unlike regular topics wherenamecan be omitted to keep the current value, this method always requires a non-empty name.- The General topic cannot have a custom icon. Only regular forum topics support
icon_custom_emoji_id— the General topic always uses the default icon. - Bot must have
can_manage_topicsadmin right. This is distinct fromcan_edit_messagesor other admin rights. - Forums must be enabled on the supergroup. If the group doesn't have the forum mode active, the method will fail with a supergroup-only error.
chat_idaccepts@usernamestrings for public supergroups. Private supergroups always require the numeric chat ID.
See Also
editForumTopic— Edit a regular (non-General) forum topichideGeneralForumTopic— Hide the General topic from the topic listunhideGeneralForumTopic— Unhide a previously hidden General topiccloseGeneralForumTopic— Close the General topic to new messagesreopenGeneralForumTopic— Reopen the General topiccreateForumTopic— Create a new regular forum topic