telegram

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: Nov 9, 2026 License: MIT Imports: 14 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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

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

func New

func New(token string, opts ...Option) (*Bot, error)

func (*Bot) Close

func (b *Bot) Close() error

func (*Bot) Delete

func (b *Bot) Delete(ctx context.Context, chatID int64, msgID int) error

func (*Bot) FinishStatus

func (b *Bot) FinishStatus(ctx context.Context, chatID int64) error

func (*Bot) Reply

func (b *Bot) Reply(handler ReplyHandler)

func (*Bot) Save

func (b *Bot) Save(ctx context.Context, fileID, dir string) (string, error)

func (*Bot) Send

func (b *Bot) Send(ctx context.Context, chatID int64, replyTo int, text string, opts ...MessageOption) (*models.Message, error)

func (*Bot) SendFile

func (b *Bot) SendFile(ctx context.Context, chatID int64, fileType FileType, path string, caption ...string) (*models.Message, error)

func (*Bot) SendInput

func (b *Bot) SendInput(ctx context.Context, chatID int64, replyTo int, text string, opts ...MessageOption) (*models.Message, error)

func (*Bot) SendMultiSelect

func (b *Bot) SendMultiSelect(ctx context.Context, chatID int64, replyTo int, text string, items []string, opts ...MessageOption) (*models.Message, error)

func (*Bot) SendPhoto

func (b *Bot) SendPhoto(ctx context.Context, chatID int64, paths []string, caption ...string) ([]*models.Message, error)

func (*Bot) SendSelect

func (b *Bot) SendSelect(ctx context.Context, chatID int64, replyTo int, text string, items []string, opts ...MessageOption) (*models.Message, error)

func (*Bot) SendStatus

func (b *Bot) SendStatus(ctx context.Context, chatID int64, replyTo int, text string, opts ...StatusOption) error

func (*Bot) SendVoice

func (b *Bot) SendVoice(ctx context.Context, chatID int64, path string, caption ...string) (*models.Message, error)

func (*Bot) SetCommands added in v0.5.1

func (b *Bot) SetCommands(ctx context.Context, commands []Command) error

func (*Bot) Start

func (b *Bot) Start(ctx context.Context) error

func (*Bot) Status

func (b *Bot) Status() Status

type ChatStatus

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

type Command added in v0.5.1

type Command struct {
	Name        string
	Description string
}

type FileType

type FileType int
const (
	TypeDocument FileType = iota
	TypeVideo
	TypeAudio
)

type Input

type Input struct {
	ChatID        int64
	ChatName      string
	MessageID     int
	UserID        int64
	Username      string
	Text          string
	Caption       string
	Photo         []models.PhotoSize
	Document      *models.Document
	CallbackData  string
	CallbackPicks []string
	Raw           *models.Update
}

type MessageOption

type MessageOption func(*messageOptions)

func WithSendType

func WithSendType(t SendType) MessageOption

type Option

type Option func(*options)

func WithHTTPClient

func WithHTTPClient(client *http.Client) Option

func WithPollTimeout

func WithPollTimeout(d time.Duration) Option

type ReplyHandler

type ReplyHandler func(ctx context.Context, input Input) string

type SendType

type SendType int
const (
	TypeMarkdown SendType = iota
	TypeHTML
)

type Status

type Status struct {
	Running  bool
	Username string
	UserID   int64
}

type StatusOption

type StatusOption func(*statusOptions)

func WithStatusEmoji

func WithStatusEmoji(emoji string) StatusOption

func WithStatusSendType

func WithStatusSendType(t SendType) StatusOption

Jump to

Keyboard shortcuts

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