tgbot

package
v0.0.0-...-e666c1a Latest Latest
Warning

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

Go to latest
Published: Nov 5, 2023 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateMessage

func CreateMessage(chatId int64, text string) *tgbotapi.MessageConfig

func CreateMessageWithOptions

func CreateMessageWithOptions(chatId int64, text string, options ...MessageWithOptions) *tgbotapi.MessageConfig

Types

type Bot

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

func NewBot

func NewBot(updatesTimeout int, scheduler *gocron.Scheduler, logger ...*slog.Logger) (*Bot, error)

func (*Bot) RegisterCommand

func (b *Bot) RegisterCommand(command string, handlers []func(*Context), responseHandler ...bool)

func (*Bot) RegisterScheduledHandler

func (b *Bot) RegisterScheduledHandler(cron string, handler func(*Context)) error

func (*Bot) RunUpdatesHandler

func (b *Bot) RunUpdatesHandler()

func (*Bot) SendMessages

func (b *Bot) SendMessages(messages []*tgbotapi.MessageConfig)

func (*Bot) StopUpdatesHandler

func (b *Bot) StopUpdatesHandler()

type Context

type Context struct {
	ChatId  int64
	Command string
	Update  tgbotapi.Update
	// contains filtered or unexported fields
}

func (*Context) Abort

func (c *Context) Abort()

func (*Context) AbortWithMessage

func (c *Context) AbortWithMessage(message string)

func (*Context) AddMessage

func (c *Context) AddMessage(message string)

func (*Context) AddMessageConfig

func (c *Context) AddMessageConfig(msg *tgbotapi.MessageConfig)

func (*Context) AddMessageWithOptions

func (c *Context) AddMessageWithOptions(message string, options MessageWithOptions)

func (*Context) GetMessages

func (c *Context) GetMessages() []*tgbotapi.MessageConfig

func (*Context) IsAborted

func (c *Context) IsAborted() bool

func (*Context) RegisterWaitForInput

func (c *Context) RegisterWaitForInput()

type MessageWithOptions

type MessageWithOptions struct {
	ParseMode             string
	DisableWebPagePreview bool
}

type WaitForCommand

type WaitForCommand struct {
	UpdateID int
	Command  string
}

Jump to

Keyboard shortcuts

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