bot

package
v1.0.5 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2025 License: MIT Imports: 1 Imported by: 0

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
}

Bot is a wrapper around the telebot.Bot providing additional functionality

func NewBot

func NewBot(opts *telebot.Settings) (*Bot, error)

NewBot creates a new Bot from the given telebot.Settings.

If opts is nil, a default telebot.Settings is used.

The returned Bot wraps the underlying telebot.Bot instance and provides additional functionality.

func (*Bot) DeleteCommands

func (b *Bot) DeleteCommands(scope *telebot.CommandScope, lang string) error

DeleteCommands deletes the commands for the bot.

If lang is empty, it will delete the commands without language. If lang is not empty, it will delete the commands for the given language.

It returns an error if the deletion fails.

func (*Bot) GetBot

func (b *Bot) GetBot() *telebot.Bot

GetBot returns the underlying telebot.Bot instance.

It is useful for getting direct access to the telebot.Bot methods and properties.

func (*Bot) SetCommands

func (b *Bot) SetCommands(commands []telebot.Command, scope *telebot.CommandScope, lang string) error

SetCommands sets the commands for the bot.

If lang is empty, it will set the commands without language. If lang is not empty, it will set the commands for the given language.

It first deletes the existing commands for the given scope and language and then sets the new commands.

It returns an error if the deletion or setting fails.

func (*Bot) Start

func (b *Bot) Start()

Start starts the underlying telebot.Bot and its poller.

It will start listening for updates and execute the registered handlers on incoming messages.

func (*Bot) Stop

func (b *Bot) Stop()

Stop stops the underlying telebot.Bot and its poller.

It will stop listening for updates and not execute the registered handlers on incoming messages.

Jump to

Keyboard shortcuts

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