keyboard

package
v2.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 25, 2026 License: GPL-3.0 Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package keyboard builds platform-neutral inline and reply keyboards.

Index

Constants

View Source
const (
	ColorPrimary   = "primary"
	ColorSecondary = "secondary"
	ColorPositive  = "positive"
	ColorNegative  = "negative"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Builder

type Builder struct {
	// contains filtered or unexported fields
}

Builder incrementally constructs a Keyboard.

func Inline

func Inline() *Builder

Inline starts an inline keyboard builder.

func Reply

func Reply() *Builder

Reply starts a reply keyboard builder.

func (*Builder) Build

func (b *Builder) Build() Keyboard

Build returns the configured keyboard value.

func (*Builder) Callback

func (b *Builder) Callback(text string, p payload.Payload) *Builder

Callback appends a callback button to the current row.

func (*Builder) Color

func (b *Builder) Color(color string) *Builder

func (*Builder) OneTime

func (b *Builder) OneTime(v bool) *Builder

func (*Builder) Persistent

func (b *Builder) Persistent(v bool) *Builder

func (*Builder) Placeholder

func (b *Builder) Placeholder(v string) *Builder

func (*Builder) Resize

func (b *Builder) Resize(v bool) *Builder

func (*Builder) Row

func (b *Builder) Row() *Builder

Row starts a new button row.

func (*Builder) Selective

func (b *Builder) Selective(v bool) *Builder

func (*Builder) Text

func (b *Builder) Text(text string) *Builder

Text appends a reply-text button to the current row.

func (*Builder) URL

func (b *Builder) URL(text, url string) *Builder

URL appends a link button to the current row.

type Button

type Button struct {
	Text    string
	Kind    ButtonKind
	Payload *payload.Payload
	URL     string
	Color   string
	Native  any
}

Button is a normalized keyboard button.

type ButtonKind

type ButtonKind string

ButtonKind identifies a button action.

const (
	ButtonCallback ButtonKind = "callback"
	ButtonURL      ButtonKind = "url"
	ButtonText     ButtonKind = "text"
	ButtonNative   ButtonKind = "native"
)

type Keyboard

type Keyboard struct {
	Kind    Kind
	Rows    [][]Button
	Options Options
}

Keyboard is a platform-neutral collection of button rows.

type Kind

type Kind string

Kind identifies keyboard presentation behavior.

const (
	KindInline Kind = "inline"
	KindReply  Kind = "reply"
)

type Options

type Options struct {
	OneTime               bool
	Resize                bool
	Persistent            bool
	Selective             bool
	InputFieldPlaceholder string
}

Options contains reply keyboard presentation hints.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL