@@ -295,21 +295,51 @@ func (f *File) Link(token string) string {
295
295
return fmt .Sprintf (FileEndpoint , token , f .FilePath )
296
296
}
297
297
298
+ var _ botkb.Keyboard = (* ReplyKeyboardMarkup )(nil )
299
+ var _ Keyboard = (* ReplyKeyboardMarkup )(nil )
300
+
298
301
// ReplyKeyboardMarkup allows the Bot to set a custom keyboard.
299
302
type ReplyKeyboardMarkup struct {
300
- Keyboard [][]KeyboardButton `json:"keyboard"`
301
- ResizeKeyboard bool `json:"resize_keyboard,omitempty"` // optional
302
- OneTimeKeyboard bool `json:"one_time_keyboard,omitempty"` // optional
303
- Selective bool `json:"selective,omitempty"` // optional
303
+ // Array of button rows, each represented by an Array of KeyboardButton objects
304
+ Keyboard [][]KeyboardButton `json:"keyboard"`
305
+
306
+ // Optional. Requests clients to always show the keyboard when the regular keyboard is hidden.
307
+ // Defaults to false, in which case the custom keyboard can be hidden and opened with a keyboard icon.
308
+ IsPersistent bool `json:"is_persistent,omitempty"`
309
+
310
+ // Optional. Requests clients to resize the keyboard vertically for optimal fit
311
+ // (e.g., make the keyboard smaller if there are just two rows of buttons).
312
+ // Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard.
313
+ ResizeKeyboard bool `json:"resize_keyboard,omitempty"` // optional
314
+
315
+ // Optional. Requests clients to hide the keyboard as soon as it's been used.
316
+ // The keyboard will still be available, but clients will automatically display the usual letter-keyboard
317
+ // in the chat - the user can press a special button in the input field to see the custom keyboard again.
318
+ //Defaults to false.
319
+ OneTimeKeyboard bool `json:"one_time_keyboard,omitempty"` // optional
320
+
321
+ // Optional. The placeholder to be shown in the input field when the keyboard is active; 1-64 characters
322
+ InputFieldPlaceholder string `json:"input_field_placeholder,omitempty"`
323
+
324
+ // Optional. Use this parameter if you want to show the keyboard to specific users only.
325
+ // Targets:
326
+ // 1) users that are @mentioned in the text of the Message object;
327
+ // 2) if the bot's message is a reply to a message in the same chat and forum topic, sender of the original message.
328
+ //
329
+ // Example: A user requests to change the bot's language, bot replies to the request with a keyboard to select the new language.
330
+ // Other users in the group don't see the keyboard.
331
+ Selective bool `json:"selective,omitempty"` // optional
332
+ }
333
+
334
+ func (m * ReplyKeyboardMarkup ) telegramKeyboardType () keyboardType {
335
+ return "reply_keyboard"
304
336
}
305
337
306
338
// KeyboardType returns KeyboardTypeBottom
307
339
func (* ReplyKeyboardMarkup ) KeyboardType () botkb.KeyboardType {
308
340
return botkb .KeyboardTypeBottom
309
341
}
310
342
311
- var _ botkb.Keyboard = (* ReplyKeyboardMarkup )(nil )
312
-
313
343
// KeyboardButtonRequestUsers represents a request from the bot to send users
314
344
// https://core.telegram.org/bots/api#keyboardbuttonrequestusers
315
345
type KeyboardButtonRequestUsers struct {
@@ -435,24 +465,36 @@ func (v WebAppInfo) Validate() error {
435
465
return nil
436
466
}
437
467
468
+ var _ botkb.Keyboard = (* ReplyKeyboardHide )(nil )
469
+ var _ Keyboard = (* ReplyKeyboardHide )(nil )
470
+
438
471
// ReplyKeyboardHide allows the Bot to hide a custom keyboard.
439
472
type ReplyKeyboardHide struct {
440
473
HideKeyboard bool `json:"hide_keyboard"`
441
474
Selective bool `json:"selective,omitempty"` // optional
442
475
}
443
476
477
+ func (h * ReplyKeyboardHide ) telegramKeyboardType () keyboardType {
478
+ return "ReplyKeyboardHide"
479
+ }
480
+
444
481
// KeyboardType returns KeyboardTypeHide
445
482
func (* ReplyKeyboardHide ) KeyboardType () botkb.KeyboardType {
446
483
return botkb .KeyboardTypeHide
447
484
}
448
485
449
- var _ botkb.Keyboard = (* ReplyKeyboardHide )(nil )
486
+ var _ botkb.Keyboard = (* InlineKeyboardMarkup )(nil )
487
+ var _ Keyboard = (* InlineKeyboardMarkup )(nil )
450
488
451
489
// InlineKeyboardMarkup is a custom keyboard presented for an inline bot.
452
490
type InlineKeyboardMarkup struct {
453
491
InlineKeyboard [][]InlineKeyboardButton `json:"inline_keyboard"`
454
492
}
455
493
494
+ func (v * InlineKeyboardMarkup ) telegramKeyboardType () keyboardType {
495
+ return "InlineKeyboardMarkup"
496
+ }
497
+
456
498
func (v * InlineKeyboardMarkup ) Validate () error {
457
499
for _ , row := range v .InlineKeyboard {
458
500
for _ , button := range row {
@@ -469,8 +511,6 @@ func (*InlineKeyboardMarkup) KeyboardType() botkb.KeyboardType {
469
511
return botkb .KeyboardTypeInline
470
512
}
471
513
472
- var _ botkb.Keyboard = (* InlineKeyboardMarkup )(nil )
473
-
474
514
// LoginUrl represents a parameter of the inline keyboard button used to automatically authorize a user.
475
515
// https://core.telegram.org/bots/api#loginurl
476
516
type LoginUrl struct {
0 commit comments