Skip to content

SwitchInlineQueryCurrentChat with empty string doesn't get parsed #245

@trust-me-im-an-engineer

Description

@trust-me-im-an-engineer

Telegram bot api doc states that switch_inline_query_current_chat parameter in InlineKeyboardButton method "May be empty, in which case just the bot's username will be inserted". However trying to send button with empty parameter like this

models.InlineKeyboardButton{
	Text:                         "This button should insert bot's username with no additional text",
	SwitchInlineQueryCurrentChat: "",
}

fails with "bad request, Bad Request: BUTTON_COPY_TEXT_INVALID" error.

Same Button with single space SwitchInlineQueryCurrentChat: " " works. But this way bot inserts name, default space and additional space we sent. So inlie query has two spaces instead of one and therefore doesn't display placeholder message .

I believe that happens because of SwitchInlineQueryCurrentChat being string and not *string so there's no way for parser to different between unsed zero-valued field and field manually set to be empty.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions