handlers

package
v0.0.0-...-cfc888a Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2022 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetStockMap

func GetStockMap(stockColl *mongo.Collection) map[string]models.StockInfo

GetStockMap create stock map cache

func PostmanDeliver

func PostmanDeliver(ctx context.Context, bot *tg.Bot, mailbox chan Mail)

PostmanDeliver will response message to bot client

func RegisterTelegramBotHandlers

func RegisterTelegramBotHandlers(bot *tg.Bot, handler *Handler)

RegisterTelegramBotHandlers register bot handers

func RenderOneUserOutput

func RenderOneUserOutput(user *models.User, stockMap map[string]models.StockInfo) *bytes.Buffer

RenderOneUserOutput render one user stock info

Types

type BotPlatform

type BotPlatform int

defined bot platform

const TelegramBot BotPlatform = 1

TelegramBot is a bot platform

type Handler

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

Handler is the handler structure, communicate with postman

func NewHandler

func NewHandler(mailbox chan Mail, configs *config.Config) *Handler

NewHandler create a handler

func (*Handler) AddStock

func (handle *Handler) AddStock(mail *Mail)

AddStock handle add command

func (*Handler) DelStock

func (handle *Handler) DelStock(mail *Mail)

DelStock handle delete command

func (*Handler) ListStock

func (handle *Handler) ListStock(mail *Mail)

ListStock handle list command

func (*Handler) QueryStock

func (handle *Handler) QueryStock(mail *Mail)

QueryStock handle query command

type Mail

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

Mail is the structure for handler and bot

Jump to

Keyboard shortcuts

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