apis

package
v0.0.0-...-8142f9b Latest Latest
Warning

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

Go to latest
Published: Mar 27, 2020 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	*telebot.Bot
}

API wraps a Telegram bot for handling messages.

func WithBot

func WithBot(bot *telebot.Bot) *API

WithBot wraps bot and returns an API instance for handling messages.

func (*API) Callback

func (api *API) Callback(cb *Callback)

Callback handles all callbacks from inline keyboards.

func (*API) Error

func (api *API) Error(req Request)

Error replies for unexpected errors.

func (*API) ErrorCallback

func (api *API) ErrorCallback(cb *Callback)

ErrorCallback responds cb with unexpected error.

func (*API) File

func (api *API) File(m *Message)

File handles messages with image files (uncompressed).

func (*API) Hello

func (api *API) Hello(m *Message)

Hello says hello to the user.

func (*API) LogError

func (api *API) LogError(req Request, args ...interface{})

LogError outputs a piece of log at the level of error.

func (*API) LogErrorf

func (api *API) LogErrorf(req Request, format string, args ...interface{})

LogErrorf outputs a piece of log for a message at the level of error.

func (*API) LogInfo

func (api *API) LogInfo(req Request, args ...interface{})

LogInfo outputs a piece of log at the level of info.

func (*API) LogInfof

func (api *API) LogInfof(req Request, format string, args ...interface{})

LogInfof outputs a piece of log for a message at the level of info.

func (*API) LogWarn

func (api *API) LogWarn(req Request, args ...interface{})

LogWarn outputs a piece of log at the level of warning.

func (*API) LogWarnf

func (api *API) LogWarnf(req Request, format string, args ...interface{})

LogWarnf outputs a piece of log for a message at the level of warning.

func (*API) Photo

func (api *API) Photo(m *Message)

Photo handles messages with photos (compressed images).

func (*API) Unsupported

func (api *API) Unsupported(req Request)

Unsupported replies to all unsupported messages.

func (*API) UnsupportedCallback

func (api *API) UnsupportedCallback(cb *Callback)

UnsupportedCallback responds cb with unsupported error.

type Callback

type Callback struct {
	*telebot.Callback
}

Callback wraps Telebot's Callback type.

func (*Callback) ReqID

func (cb *Callback) ReqID() string

ReqID returns the ID of cb.

func (*Callback) Sender

func (cb *Callback) Sender() *telebot.User

Sender returns the sender of cb.

type Message

type Message struct {
	*telebot.Message
}

Message wraps Telebot's Message type.

func (*Message) ReqID

func (m *Message) ReqID() string

ReqID returns the ID of m.

func (*Message) Sender

func (m *Message) Sender() *telebot.User

Sender returns the sender of m.

type Request

type Request interface {
	ReqID() string
	Sender() *telebot.User
}

Request is an interface for all Telegram request types (message, callback, etc.).

Jump to

Keyboard shortcuts

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