Skip to content

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

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

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

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
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