1
bot/models/reply_markup.go

129 lines
6.2 KiB
Go
Raw Permalink Normal View History

2022-04-26 00:02:51 +08:00
package models
2023-06-14 15:51:00 +08:00
type ReplyMarkup any
2022-04-26 00:02:51 +08:00
2022-04-29 17:21:42 +08:00
// InlineKeyboardMarkup https://core.telegram.org/bots/api#inlinekeyboardmarkup
2022-04-26 00:02:51 +08:00
type InlineKeyboardMarkup struct {
InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard"`
}
2022-04-29 17:21:42 +08:00
// LoginURL https://core.telegram.org/bots/api#loginurl
type LoginURL struct {
URL string `json:"url"`
ForwardText string `json:"forward_text,omitempty"`
BotUsername string `json:"bot_username,omitempty"`
RequestWriteAccess bool `json:"request_write_access,omitempty"`
}
2023-04-24 14:11:48 +08:00
// SwitchInlineQueryChosenChat https://core.telegram.org/bots/api#switchinlinequerychosenchat
type SwitchInlineQueryChosenChat struct {
Query string `json:"query,omitempty"`
AllowUserChats bool `json:"allow_user_chats,omitempty"`
AllowBotChats bool `json:"allow_bot_chats,omitempty"`
AllowGroupChats bool `json:"allow_group_chats,omitempty"`
AllowChannelChats bool `json:"allow_channel_chats,omitempty"`
}
2024-10-31 23:39:49 +08:00
// CopyTextButton https://core.telegram.org/bots/api#copytextbutton
type CopyTextButton struct {
Text string `json:"text"`
}
2022-04-29 17:21:42 +08:00
// InlineKeyboardButton https://core.telegram.org/bots/api#inlinekeyboardbutton
2022-04-26 00:02:51 +08:00
type InlineKeyboardButton struct {
2023-04-24 14:11:48 +08:00
Text string `json:"text"`
URL string `json:"url,omitempty"`
CallbackData string `json:"callback_data,omitempty"`
WebApp *WebAppInfo `json:"web_app,omitempty"`
LoginURL *LoginURL `json:"login_url,omitempty"`
SwitchInlineQuery string `json:"switch_inline_query,omitempty"`
SwitchInlineQueryCurrentChat string `json:"switch_inline_query_current_chat,omitempty"`
SwitchInlineQueryChosenChat *SwitchInlineQueryChosenChat `json:"switch_inline_query_chosen_chat,omitempty"`
2024-10-31 23:39:49 +08:00
CopyText CopyTextButton `json:"copy_text,omitempty"`
2023-04-24 14:11:48 +08:00
CallbackGame *CallbackGame `json:"callback_game,omitempty"`
Pay bool `json:"pay,omitempty"`
2022-04-26 00:02:51 +08:00
}
2022-04-29 17:21:42 +08:00
// ReplyKeyboardMarkup https://core.telegram.org/bots/api#replykeyboardmarkup
2022-04-26 00:02:51 +08:00
type ReplyKeyboardMarkup struct {
2022-04-29 17:21:42 +08:00
Keyboard [][]KeyboardButton `json:"keyboard"`
2023-01-10 16:18:24 +08:00
IsPersistent bool `json:"is_persistent,omitempty"`
2022-04-29 17:21:42 +08:00
ResizeKeyboard bool `json:"resize_keyboard,omitempty"`
OneTimeKeyboard bool `json:"one_time_keyboard,omitempty"`
InputFieldPlaceholder string `json:"input_field_placeholder,omitempty"`
Selective bool `json:"selective,omitempty"`
2022-04-26 00:02:51 +08:00
}
2022-04-29 17:21:42 +08:00
// KeyboardButton https://core.telegram.org/bots/api#keyboardbutton
2022-04-26 00:02:51 +08:00
type KeyboardButton struct {
2024-01-10 20:16:04 +08:00
Text string `json:"text"`
RequestUser *KeyboardButtonRequestUsers `json:"request_user,omitempty"`
RequestUsers *KeyboardButtonRequestUsers `json:"request_users,omitempty"`
RequestChat *KeyboardButtonRequestChat `json:"request_chat,omitempty"`
RequestContact bool `json:"request_contact,omitempty"`
RequestLocation bool `json:"request_location,omitempty"`
RequestPoll *KeyboardButtonPollType `json:"request_poll,omitempty"`
WebApp *WebAppInfo `json:"web_app,omitempty"`
2023-02-06 15:54:44 +08:00
}
// KeyboardButtonRequestUser https://core.telegram.org/bots/api#keyboardbuttonrequestuser
type KeyboardButtonRequestUser struct {
RequestID int32 `json:"request_id"`
UserIsBot bool `json:"user_is_bot,omitempty"`
UserIsPremium bool `json:"user_is_premium,omitempty"`
}
2024-01-10 20:16:04 +08:00
// KeyboardButtonRequestUsers https://core.telegram.org/bots/api#keyboardbuttonrequestusers
type KeyboardButtonRequestUsers struct {
2024-04-02 23:09:36 +08:00
RequestID int32 `json:"request_id"`
UserIsBot bool `json:"user_is_bot,omitempty"`
UserIsPremium bool `json:"user_is_premium,omitempty"`
MaxQuantity int `json:"max_quantity,omitempty"`
RequestName bool `json:"request_name,omitempty"`
RequestUsername bool `json:"request_username,omitempty"`
RequestPhoto bool `json:"request_photo,omitempty"`
2024-01-10 20:16:04 +08:00
}
2023-02-06 15:54:44 +08:00
// KeyboardButtonRequestChat https://core.telegram.org/bots/api#keyboardbuttonrequestchat
type KeyboardButtonRequestChat struct {
RequestID int32 `json:"request_id"`
ChatIsChannel bool `json:"chat_is_channel"`
ChatIsForum bool `json:"chat_is_forum,omitempty"`
ChatHasUsername bool `json:"chat_has_username,omitempty"`
ChatIsCreated bool `json:"chat_is_created,omitempty"`
UserAdministratorRights *ChatAdministratorRights `json:"user_administrator_rights,omitempty"`
BotAdministratorRights *ChatAdministratorRights `json:"bot_administrator_rights,omitempty"`
BotIsMember bool `json:"bot_is_member,omitempty"`
2024-04-02 23:09:36 +08:00
RequestTitle bool `json:"request_title,omitempty"`
RequestUsername bool `json:"request_username,omitempty"`
RequestPhoto bool `json:"request_photo,omitempty"`
2022-04-26 00:02:51 +08:00
}
2022-04-29 17:21:42 +08:00
// KeyboardButtonPollType https://core.telegram.org/bots/api#keyboardbuttonpolltype
2022-04-26 00:02:51 +08:00
type KeyboardButtonPollType struct {
Type string `json:"type,omitempty"`
}
type CallbackGame struct {
2023-03-01 15:26:05 +08:00
UserID int64 `json:"user_id"`
Score int `json:"score"`
Force bool `json:"force,omitempty"`
DisableEditMessage bool `json:"disable_edit_message,omitempty"`
ChatID int `json:"chat_id,omitempty"`
MessageID int `json:"message_id,omitempty"`
InlineMessageID int `json:"inline_message_id,omitempty"`
2022-04-26 00:02:51 +08:00
}
2022-04-29 17:21:42 +08:00
// ReplyKeyboardRemove https://core.telegram.org/bots/api#replykeyboardremove
2022-04-26 00:02:51 +08:00
type ReplyKeyboardRemove struct {
RemoveKeyboard bool `json:"remove_keyboard"`
Selective bool `json:"selective,omitempty"`
}
2022-04-29 17:21:42 +08:00
// ForceReply https://core.telegram.org/bots/api#forcereply
2022-04-26 00:02:51 +08:00
type ForceReply struct {
ForceReply bool `json:"force_reply"`
InputFieldPlaceholder string `json:"input_field_placeholder,omitempty"`
Selective bool `json:"selective,omitempty"`
}