Skip to content

fix: correct reply_to_story field name and json tag on Message#287

Open
Kazemir wants to merge 1 commit into
go-telegram:mainfrom
Kazemir:fix/reply-to-story-field
Open

fix: correct reply_to_story field name and json tag on Message#287
Kazemir wants to merge 1 commit into
go-telegram:mainfrom
Kazemir:fix/reply-to-story-field

Conversation

@Kazemir

@Kazemir Kazemir commented Jul 5, 2026

Copy link
Copy Markdown

Problem

Message.ReplyToStore is declared with a json:"reply_to_store" tag — a typo of the Bot API field, which is reply_to_story (a Story sent in reply to a story). Because the tag doesn't match, Telegram's reply_to_story is never unmarshalled and the field is always nil.

Fix

  • Rename the field ReplyToStoreReplyToStory and fix the tag to reply_to_story.
  • Add an unmarshal test covering the field.

The field isn't referenced anywhere else in the library, and it never populated before, so nothing depended on the old (typo) name.

Verification

  • gofmt clean, go vet ./models/ clean.
  • go test ./models/ passes, including the new TestUnmarshalMessage_replyToStory.

The field for the Bot API `reply_to_story` was declared as `ReplyToStore`
with a `json:"reply_to_store"` tag (typo: "store" instead of "story"), so
Telegram's `reply_to_story` was never unmarshalled into the struct.

Rename the field to `ReplyToStory` and fix the tag to `reply_to_story`.
Add an unmarshal test covering the field.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant