telegram

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2020 License: MPL-2.0 Imports: 2 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 struct of bot

func NewBot

func NewBot(params *BotParams) (*Bot, error)

NewBot creates new bot

func (*Bot) OnCondition

func (bot *Bot) OnCondition(condition Condition, callback OnMessageCallback)

OnCondition registers callback on any message that satisfies condition

func (*Bot) OnMessage

func (bot *Bot) OnMessage(messageText string, callback OnMessageCallback)

OnMessage registers callback on message

func (*Bot) Start

func (bot *Bot) Start() error

Start creates and starts telegram bot

func (*Bot) Stop

func (bot *Bot) Stop()

Stop bot

type BotAPI

type BotAPI = tgbotapi.BotAPI

BotAPI allows you to interact with the Telegram Bot API

type BotParams

type BotParams struct {
	Token string `json:"token"`
}

BotParams is structure with params of the bot

type Condition

type Condition = func(message tgbotapi.Message) bool

Condition function checks is the message satisfies to be called

type Message

type Message = tgbotapi.Message

Message contains data about almost anything.

type OnMessageCallback

type OnMessageCallback = func(message tgbotapi.Message, botAPI *tgbotapi.BotAPI, bot *Bot)

OnMessageCallback is callback of message event

Jump to

Keyboard shortcuts

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