bot

package
v0.0.0-...-6f48dd4 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2023 License: AGPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const RunnerQueue = "default"
View Source
const RunnerTask = "bot-runner"

Variables

This section is empty.

Functions

func NewBotTask

func NewBotTask(botID int64) (*asynq.Task, error)

Types

type Info

type Info struct {
	ID      int64  `bson:"_id"     json:"id"`
	Token   string `bson:"token"   json:"token"`
	Enabled bool   `bson:"enabled" json:"enabled"`
	TaskID  string `bson:"taskID"  json:"taskID,omitempty"`
}

type Repository

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

func NewRepository

func NewRepository(in *do.Injector) (*Repository, error)

func (*Repository) BotInfo

func (r *Repository) BotInfo(ctx context.Context, id int64) (Info, error)

func (*Repository) Bots

func (r *Repository) Bots(ctx context.Context) ([]Info, error)

func (*Repository) CreateBot

func (r *Repository) CreateBot(ctx context.Context, id int64, token string) error

func (*Repository) UpdateBotInfo

func (r *Repository) UpdateBotInfo(ctx context.Context, info Info) error

type TaskClient

type TaskClient struct {
	*asynq.Client
}

func NewTaskClient

func NewTaskClient(in *do.Injector) (*TaskClient, error)

func (*TaskClient) Shutdown

func (c *TaskClient) Shutdown() error

type TaskInspector

type TaskInspector struct {
	*asynq.Inspector
}

func NewTaskInspector

func NewTaskInspector(in *do.Injector) (*TaskInspector, error)

func (*TaskInspector) Shutdown

func (i *TaskInspector) Shutdown() error

type TaskPayload

type TaskPayload struct {
	BotID int64 `json:"bot_id"`
}

type TaskServer

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

func NewTaskServer

func NewTaskServer(in *do.Injector) (*TaskServer, error)

func (*TaskServer) Shutdown

func (s *TaskServer) Shutdown() error

func (*TaskServer) Start

func (s *TaskServer) Start() error

type WebhookServer

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

func NewWebhookServer

func NewWebhookServer(in *do.Injector) (*WebhookServer, error)

func (*WebhookServer) RegisterBot

func (w *WebhookServer) RegisterBot(path string, handler telego.WebhookHandler) error

func (*WebhookServer) Shutdown

func (w *WebhookServer) Shutdown() error

func (*WebhookServer) Start

func (w *WebhookServer) Start() error

func (*WebhookServer) UnregisterBot

func (w *WebhookServer) UnregisterBot(botID int64)

Jump to

Keyboard shortcuts

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