Skip to content

Commit dea9904

Browse files
committed
fix: omitempty allow_*_chats fields
1 parent 7ed85b3 commit dea9904

File tree

2 files changed

+37
-21
lines changed

2 files changed

+37
-21
lines changed

tgbotapi/types.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -639,17 +639,20 @@ type SwitchInlineQueryChosenChat struct {
639639
//The default inline query to be inserted in the input field. If left empty, only the bot's username will be inserted
640640
Query string `json:"query,omitempty"`
641641

642+
// Known issue in macOS Telegram Desktop not respecting allow_*_chats field:
643+
// https://github.com/overtake/TelegramSwift/issues/1213
644+
642645
// Optional. True, if private chats with users can be chosen
643-
AllowUserChats bool `json:"allow_user_chats"` // DO not omit this field, as it defaults to TRUE
646+
AllowUserChats bool `json:"allow_user_chats,omitempty"`
644647

645648
// Optional. True, if private chats with bots can be chosen
646-
AllowBotChats bool `json:"allow_bot_chats"` // DO not omit this field, as it defaults to TRUE
649+
AllowBotChats bool `json:"allow_bot_chats,omitempty"`
647650

648651
// Optional. True, if group and supergroup chats can be chosen
649-
AllowGroupChats bool `json:"allow_group_chats"` // DO not omit this field, as it defaults to TRUE
652+
AllowGroupChats bool `json:"allow_group_chats,omitempty"`
650653

651654
// Optional. True, if channel chats can be chosen
652-
AllowChannelChats bool `json:"allow_channel_chats"` // DO not omit this field, as it defaults to TRUE
655+
AllowChannelChats bool `json:"allow_channel_chats,omitempty"`
653656
}
654657

655658
func (v SwitchInlineQueryChosenChat) Validate() error {

tgbotapi/types_ffjson.go

Lines changed: 30 additions & 17 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)