Skip to content

fix: correct KeyboardButton.RequestUser type and use pointer for bool…#262

Closed
zhenyueyue wants to merge 1 commit intogo-telegram:mainfrom
zhenyueyue:fix/keyboard-button-request-user
Closed

fix: correct KeyboardButton.RequestUser type and use pointer for bool…#262
zhenyueyue wants to merge 1 commit intogo-telegram:mainfrom
zhenyueyue:fix/keyboard-button-request-user

Conversation

@zhenyueyue
Copy link
Copy Markdown

Description

This pull request fixes a bug in the KeyboardButton struct where the RequestUser field was incorrectly typed as *KeyboardButtonRequestUsers instead of *KeyboardButtonRequestUser. Additionally, the optional boolean fields UserIsBot and UserIsPremium in KeyboardButtonRequestUser were defined as non-pointer bool, which prevented the omitempty JSON tag from working correctly (i.e., it was impossible to distinguish between an unset field and an explicit false value).

Changes

  • Changed KeyboardButton.RequestUser type from *KeyboardButtonRequestUsers to *KeyboardButtonRequestUser.
  • Changed KeyboardButtonRequestUser.UserIsBot from bool to *bool.
  • Changed KeyboardButtonRequestUser.UserIsPremium from bool to *bool.

TGlimmer added a commit to TGlimmer/gobot that referenced this pull request Mar 4, 2026
…go-telegram#262

- go-telegram#261: fix SetMyProfilePhoto missing `type` field by checking runtime
  concrete type behind interface fields in buildRequestForm
- go-telegram#245: change SwitchInlineQuery and SwitchInlineQueryCurrentChat to
  *string, and CopyText to *CopyTextButton, to properly handle empty
  string values and prevent zero-value struct leaking in JSON
- go-telegram#242: handle dual return type (Message or bool) for all Edit*/Stop*
  methods when editing inline messages
- go-telegram#262: fix KeyboardButton.RequestUser type from *KeyboardButtonRequestUsers
  to *KeyboardButtonRequestUser, and change UserIsBot/UserIsPremium to *bool
TGlimmer added a commit to TGlimmer/gobot that referenced this pull request Mar 4, 2026
…go-telegram#262

- go-telegram#261: fix SetMyProfilePhoto missing `type` field by checking runtime
  concrete type behind interface fields in buildRequestForm
- go-telegram#245: change SwitchInlineQuery and SwitchInlineQueryCurrentChat to
  *string, and CopyText to *CopyTextButton, to properly handle empty
  string values and prevent zero-value struct leaking in JSON
- go-telegram#242: handle dual return type (Message or bool) for all Edit*/Stop*
  methods when editing inline messages
- go-telegram#262: fix KeyboardButton.RequestUser type from *KeyboardButtonRequestUsers
  to *KeyboardButtonRequestUser, and change UserIsBot/UserIsPremium to *bool
ruizlenato pushed a commit to ruizlenato/bot that referenced this pull request Mar 5, 2026
negasus pushed a commit that referenced this pull request Mar 19, 2026
)

* fix: resolve issues #242, #245, #261, #262

- #261: fix SetMyProfilePhoto missing `type` field by checking runtime
  concrete type behind interface fields in buildRequestForm
- #245: change SwitchInlineQuery and SwitchInlineQueryCurrentChat to
  *string, and CopyText to *CopyTextButton, to properly handle empty
  string values and prevent zero-value struct leaking in JSON
- #242: handle dual return type (Message or bool) for all Edit*/Stop*
  methods when editing inline messages
- #262: fix KeyboardButton.RequestUser type from *KeyboardButtonRequestUsers
  to *KeyboardButtonRequestUser, and change UserIsBot/UserIsPremium to *bool

* feat: support Telegram Bot API 9.5

- Add setChatMemberTag method and SetChatMemberTagParams
- Add MessageEntity type "date_time" with unix_time and date_time_format fields
- Add tag field to ChatMemberMember and ChatMemberRestricted
- Add can_edit_tag to ChatMemberRestricted and ChatPermissions
- Add can_manage_tags to ChatMemberAdministrator, ChatAdministratorRights,
  and PromoteChatMemberParams
- Add sender_tag field to Message

* fix: replace unicode smart quotes with ASCII quotes in ChatMemberMember struct tags

The ChatMemberMember struct contained Unicode right double quotation marks
(U+201D) instead of ASCII double quotes (U+0022) in JSON struct tags,
causing golangci-lint structtag check to fail. Also fixes smart quotes
in comments across ChatMember types for consistency.
@negasus negasus closed this in #263 Mar 19, 2026
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