bot

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Nov 3, 2022 License: AGPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const MessageInteractionIdSeparator = ":"

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot

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

func New

func New(cfg config.Bot, repo db.Repo, scrapeManager *scraper.ScrapeManager, logger logrus.FieldLogger) *Bot

func (*Bot) Close

func (b *Bot) Close() error

func (*Bot) Start

func (b *Bot) Start(ctx context.Context) error

type InteractionHandler

type InteractionHandler func(s *discordgo.Session, i *discordgo.InteractionCreate, logger logrus.FieldLogger)

type InteractionHandlers

type InteractionHandlers map[InteractionName]InteractionHandler

type InteractionName

type InteractionName string
const (
	GetAlertsCommandName InteractionName = "get-alerts"

	ShowInhibitedAlertsCommandName InteractionName = "show-inhibited-alerts"
	InhibitAlertCommandName        InteractionName = "inhibit-alert"
	UninhibitAlertCommandName      InteractionName = "uninhibit-alert"

	CreateScrapeConfigCommandName InteractionName = "create-scrape-config"
	UpdateScrapeConfigCommandName InteractionName = "update-scrape-config"
	RemoveScrapeConfigCommandName InteractionName = "remove-scrape-config"
)

func (InteractionName) String

func (c InteractionName) String() string

type InteractionOption

type InteractionOption string
const (
	ChannelOption          InteractionOption = "channel"
	UserOption             InteractionOption = "user"
	AlertNameOption        InteractionOption = "alertname"
	ScrapeConfigNameOption InteractionOption = "scrape-config-name"
	EndpointOption         InteractionOption = "endpoint"
	UsernameOption         InteractionOption = "username"
	PasswordOption         InteractionOption = "password"
	IntervalOption         InteractionOption = "interval"
)

func (InteractionOption) String

func (c InteractionOption) String() string

type MessageInteractionHandlers

type MessageInteractionHandlers map[InteractionName]InteractionHandler

type MessageInteractionId

type MessageInteractionId string

func NewMessageInteractionId

func NewMessageInteractionId(name InteractionName, values ...string) MessageInteractionId

func (MessageInteractionId) Name

func (MessageInteractionId) String

func (id MessageInteractionId) String() string

func (MessageInteractionId) Values

func (id MessageInteractionId) Values() ([]string, bool)

Jump to

Keyboard shortcuts

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