bot

package
v0.0.0-...-52bb2e6 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2019 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BirdService

type BirdService interface {
	PrintTextToBird(birdID, text string) (*memobird.PrintResult, error)
	BindBirdWithMessage(birdID, msg string) (*memobird.PrintResult, error)
}

BirdService represents the ability of the bird service.

type Bot

type Bot struct {
	*Config
	*tb.Bot
}

Bot is a telegram bot.

func New

func New(config *Config) (*Bot, error)

New creates a new telegram bot.

type Config

type Config struct {
	Token         string
	PollerTimeout time.Duration

	UserService   UserService
	DeviceService DeviceService
	BirdService   BirdService
}

Config contains configurations to create a bot.

type DeviceService

type DeviceService interface {
	IsFree(memobirdID string) (bool, error)
	New(*model.Device) (*model.Device, error)
	GetByUserID(uint) (*model.Device, error)
	VerifyCodeByUserID(code string, userID uint) (bool, error)
}

DeviceService represents the ability of the device service.

type UserService

type UserService interface {
	IsExistsByTelegramID(telegramID int) (bool, error)
	GetByTelegramID(telegramID int) (*model.User, error)
	New(*model.User) error
}

UserService represents the ability of the user service.

Jump to

Keyboard shortcuts

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