worker

package
v0.0.0-...-1ffa49a Latest Latest
Warning

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

Go to latest
Published: Mar 17, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatSearchResult

func FormatSearchResult(start int, result *cypress.Result, resultPerPage int) string

FormatSearchResult format the search result and build the message text for telegram reply

func TimerDeleteMessage

func TimerDeleteMessage(n int, f func()) *time.Timer

TimerDeleteMessage will call the function f after n seconds

Types

type BotCmdWorker

type BotCmdWorker struct {
	//BotToken string
	QueryCache map[string]*cypress.SearchClause
	TimerCache map[string]*time.Timer
}

BotCmd worker struct

func NewBotCmdWorker

func NewBotCmdWorker() *BotCmdWorker

func (*BotCmdWorker) AddCache

func (botcmdworker *BotCmdWorker) AddCache(messageID int, chatID int64, clause *cypress.SearchClause)

func (*BotCmdWorker) DelCache

func (botcmdworker *BotCmdWorker) DelCache(messageID int, chatID int64)

func (*BotCmdWorker) GetFromCache

func (botcmdworker *BotCmdWorker) GetFromCache(messageID int, chatID int64) *cypress.SearchClause

func (*BotCmdWorker) RegTimer

func (botcmdworker *BotCmdWorker) RegTimer(messageID int, chatID int64, timer *time.Timer)

func (*BotCmdWorker) ResetTimer

func (botcmdworker *BotCmdWorker) ResetTimer(messageID int, chatID int64, n int)

func (*BotCmdWorker) TGBotButtonQuery

func (botcmdworker *BotCmdWorker) TGBotButtonQuery(tgservice *service.Telegram, conf *TGBotCommandConf, cypressapi *cypress.API, query *tgbotapi.CallbackQuery)

TGBotCommand telegram bot command processor

func (*BotCmdWorker) TGBotCommand

func (botcmdworker *BotCmdWorker) TGBotCommand(tgservice *service.Telegram, conf *TGBotCommandConf, cypressapi *cypress.API, message *tgbotapi.Message)

TGBotCommand telegram bot command processor

func (*BotCmdWorker) UnregTimer

func (botcmdworker *BotCmdWorker) UnregTimer(messageID int, chatID int64)

type TGBotCommandConf

type TGBotCommandConf struct {
	DeleteAfterSeconds int
	ResultPerPage      int
}

Jump to

Keyboard shortcuts

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