From 941d94849515b57a2602f14737e1ca25e7e59846 Mon Sep 17 00:00:00 2001 From: alex Date: Fri, 26 Jun 2026 10:49:23 -0300 Subject: [PATCH] fix(models): add correctly-tagged CanDeleteSentMessages to BusinessBotRights Telegram's BusinessBotRights uses `can_delete_sent_messages`, but the struct only exposed CanDeleteOutgoingMessages tagged `can_delete_outgoing_messages`, so the right was silently dropped on unmarshal (always false) and emitted under the wrong key on marshal. Add CanDeleteSentMessages with the correct tag. The old field is kept as a deprecated, JSON-ignored alias (`json:"-"`) so existing references keep compiling; it was always false before, so this changes no behavior. Ref: https://core.telegram.org/bots/api#businessbotrights --- models/business.go | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/models/business.go b/models/business.go index a6e9400..6e8b5bf 100644 --- a/models/business.go +++ b/models/business.go @@ -45,7 +45,7 @@ type BusinessOpeningHoursInterval struct { type BusinessBotRights struct { CanReply bool `json:"can_reply,omitempty"` CanReadMessages bool `json:"can_read_messages,omitempty"` - CanDeleteOutgoingMessages bool `json:"can_delete_outgoing_messages,omitempty"` + CanDeleteSentMessages bool `json:"can_delete_sent_messages,omitempty"` CanDeleteAllMessages bool `json:"can_delete_all_messages,omitempty"` CanEditName bool `json:"can_edit_name,omitempty"` CanEditBio bool `json:"can_edit_bio,omitempty"` @@ -57,4 +57,8 @@ type BusinessBotRights struct { CanTransferAndUpgradeGifts bool `json:"can_transfer_and_upgrade_gifts,omitempty"` CanTransferStars bool `json:"can_transfer_stars,omitempty"` CanManageStories bool `json:"can_manage_stories,omitempty"` + + // Deprecated: historically mistagged as can_delete_outgoing_messages and so + // never populated by Telegram. Use CanDeleteSentMessages. + CanDeleteOutgoingMessages bool `json:"-"` }