plugin

package
v0.0.0-...-251d348 Latest Latest
Warning

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

Go to latest
Published: Jan 9, 2025 License: Unlicense Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CallbackHandler

type CallbackHandler struct {
	HandlerFunc  GobotHandlerFunc
	Trigger      *regexp.Regexp
	AdminOnly    bool
	DeleteButton bool
	Cooldown     time.Duration
}

func (*CallbackHandler) Command

func (h *CallbackHandler) Command() any

func (*CallbackHandler) Run

func (h *CallbackHandler) Run(b *gotgbot.Bot, c GobotContext) error

type CommandHandler

type CommandHandler struct {
	Trigger     any
	HandlerFunc GobotHandlerFunc
	AdminOnly   bool
	GroupOnly   bool
	HandleEdits bool
}

func (*CommandHandler) Command

func (h *CommandHandler) Command() any

func (*CommandHandler) Run

func (h *CommandHandler) Run(b *gotgbot.Bot, c GobotContext) error

type GobotContext

type GobotContext struct {
	*ext.Context
	Matches      []string          // Regex matches
	NamedMatches map[string]string // Named Regex matches
}

type GobotHandlerFunc

type GobotHandlerFunc func(b *gotgbot.Bot, c GobotContext) error

type Handler

type Handler interface {
	Command() any
	Run(b *gotgbot.Bot, c GobotContext) error
}

type InlineHandler

type InlineHandler struct {
	HandlerFunc         GobotHandlerFunc
	Trigger             *regexp.Regexp
	AdminOnly           bool
	CanBeUsedByEveryone bool
}

func (*InlineHandler) Command

func (h *InlineHandler) Command() any

func (*InlineHandler) Run

func (h *InlineHandler) Run(b *gotgbot.Bot, c GobotContext) error

type Plugin

type Plugin interface {
	Name() string

	// Commands will be shown in the menu button
	Commands() []gotgbot.BotCommand

	// Handlers are used to react to specific strings & entities in a message
	Handlers(botInfo *gotgbot.User) []Handler
}

Jump to

Keyboard shortcuts

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