deleteChatStickerSet
Returns: TrueOfficial docs ↗
Use this method to delete a group sticker set from a supergroup. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Use the field can_set_sticker_set optionally returned in getChat requests to check if the bot can use this method. 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
// Remove the sticker set from a supergroup by numeric ID
await bot.api.deleteChatStickerSet({
chat_id: -1001234567890,
});ts
// Remove the sticker set from a supergroup by username
await bot.api.deleteChatStickerSet({
chat_id: "@mysupergroup",
});ts
// Admin command to remove the group sticker set
bot.command("removestickers", async (ctx) => {
await bot.api.deleteChatStickerSet({ chat_id: ctx.chatId });
await ctx.send("Group sticker set has been removed.");
});Errors
| Code | Error | Cause |
|---|---|---|
| 400 | Bad Request: chat not found | chat_id is invalid or inaccessible |
| 400 | Bad Request: CHAT_NOT_MODIFIED | The supergroup has no sticker set to remove |
| 400 | Bad Request: method is available for supergroup chats only | This method only works for supergroups — not regular groups or channels |
| 403 | Forbidden: not enough rights | Bot is not an admin or lacks the right to manage sticker sets |
| 429 | Too Many Requests: retry after N | Rate limit hit — check retry_after, use auto-retry plugin |
Tips & Gotchas
- Supergroups only — not regular groups or channels. This method is restricted to supergroups. Calling it on a basic group or channel will fail.
- Check
can_set_sticker_setfromgetChatfirst. TheChatobject returned bygetChathas an optionalcan_set_sticker_setboolean. If it'sfalseor absent, the bot cannot manage the sticker set in that chat. - No need to delete before setting a new sticker set. Calling
setChatStickerSetdirectly replaces the current sticker set — you don't need to calldeleteChatStickerSetbeforehand. - Bot must be admin with
can_change_info. The appropriate administrator right for managing sticker sets falls undercan_change_info.
See Also
- setChatStickerSet — assign a sticker set to a supergroup
- getChat — check
can_set_sticker_setbefore calling