package
0.4.0
Repository: https://github.com/go-telegram/ui.git
Documentation: pkg.go.dev

# README

Reply Keyboard

reply_keyboard.png

Getting Started

package main

import (
	"context"

	"github.com/go-telegram/bot"
	"github.com/go-telegram/bot/models"
	"github.com/go-telegram/ui/keyboard/reply"
)

var demoReplyKeyboard *reply.ReplyKeyboard

func initReplyKeyboard(b *bot.Bot) {
	demoReplyKeyboard = reply.New(
		b,
		reply.WithPrefix("reply_keyboard"),
		reply.IsSelective(),
		reply.IsOneTimeKeyboard(),
	).
		Button("Button", b, bot.MatchTypeExact, onReplyKeyboardSelect).
		Row().
		Button("Cancel", b, bot.MatchTypeExact, onReplyKeyboardSelect)
}

func handlerReplyKeyboard(ctx context.Context, b *bot.Bot, update *models.Update) {
	b.SendMessage(ctx, &bot.SendMessageParams{
		ChatID:      update.Message.Chat.ID,
		Text:        "Select example command from reply keyboard:",
		ReplyMarkup: demoReplyKeyboard,
	})
}

func onReplyKeyboardSelect(ctx context.Context, b *bot.Bot, update *models.Update) {
	b.SendMessage(ctx, &bot.SendMessageParams{
		ChatID: update.Message.Chat.ID,
		Text:   "You selected: " + string(update.Message.Text),
	})
}

Options

See in options.go file

# Functions

IsPersistent is a keyboard placeholder to be shown in the input field when the keyboard is active.
IsOneTimeKeyboard is a keyboard option that if setted will force the client to hide the keyboard after being used.
IsPersistent is a keyboard option that requests clients to always show the keyboard when the regular keyboard is hidden.
IsSelective is a keyboard option that will show the keyboard only to specific users.
No description provided by the author
ResizableKeyboard is a keyboard option that requests clients to resize the keyboard vertically for optimal fit.
WithPrefix is a keyboard option that sets a prefix for the widget.

# Structs

No description provided by the author

# Type aliases

No description provided by the author