removeMyProfilePhoto
Returns: TrueOfficial docs ↗
Removes the profile photo of the bot. Requires no parameters. Returns True on success.
Returns
On success, True is returned.
GramIO Usage
ts
// Remove the bot's profile photo (no parameters needed)
await bot.api.removeMyProfilePhoto();ts
// Remove the profile photo in a command handler
bot.command("resetphoto", async (ctx) => {
await bot.api.removeMyProfilePhoto();
await ctx.reply("Bot profile photo removed.");
});ts
// Pair with setMyProfilePhoto to rotate/update the bot avatar
bot.command("clearphoto", async (ctx) => {
try {
await bot.api.removeMyProfilePhoto();
await ctx.reply("Profile photo cleared successfully.");
} catch {
await ctx.reply("Failed to remove profile photo — it may already be unset.");
}
});Errors
| Code | Error | Cause |
|---|---|---|
| 400 | Bad Request: PHOTO_INVALID | The bot does not currently have a profile photo set — safe to ignore |
| 429 | Too Many Requests: retry after N | Rate limit hit — check retry_after and use the auto-retry plugin |
Tips & Gotchas
- No parameters required.
removeMyProfilePhoto()takes no arguments — just call it directly. - Idempotent in practice but may throw. If the bot has no profile photo, the API may return an error rather than silently succeeding. Wrap the call in a
try/catchif the state is uncertain. - Pair with
setMyProfilePhoto. UsesetMyProfilePhototo upload a new photo, thenremoveMyProfilePhototo reset it. Together they give you full lifecycle control over the bot's avatar. - Changes are visible immediately. After a successful call, Telegram updates the bot's avatar everywhere without any delay.
See Also
setMyProfilePhoto— upload a new profile photo for the botgetUserProfilePhotos— retrieve a user's profile photos