discord

package
v0.0.35 Latest Latest
Warning

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

Go to latest
Published: Sep 1, 2025 License: GPL-3.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bot added in v0.0.11

type Bot interface {
	BotCore
	BotServices
	GetRoleConfig() *common.RoleConfig
	SetCommands(commands []common.Command)
	GetQueues() []queue.Queuer
}

Bot is the interface for the Discord bot.

func NewBot added in v0.0.11

func NewBot(
	log *logrus.Logger,
	cfg *Config,
	scheduler *scheduler.Scheduler,
	monitorRepo *store.MonitorRepo,
	checksRepo *store.ChecksRepo,
	mentionsRepo *store.MentionsRepo,
	hiveSummaryRepo *store.HiveSummaryRepo,
	grafana grafana.Client,
	hive hive.Hive,
	metrics *Metrics,

	cartographoor *cartographoor.Service,
) (Bot, error)

NewBot creates a new Discord bot.

type BotCore added in v0.0.11

type BotCore interface {
	Start(ctx context.Context) error
	Stop(ctx context.Context) error
	GetSession() *discordgo.Session
}

BotCore is the core interface for the Discord bot.

type BotServices added in v0.0.11

type BotServices interface {
	GetScheduler() *scheduler.Scheduler
	GetMonitorRepo() *store.MonitorRepo
	GetChecksRepo() *store.ChecksRepo
	GetMentionsRepo() *store.MentionsRepo
	GetHiveSummaryRepo() *store.HiveSummaryRepo
	GetGrafana() grafana.Client
	GetHive() hive.Hive
	GetCartographoor() *cartographoor.Service
}

BotServices is the services interface for the Discord bot.

type Config added in v0.0.11

type Config struct {
	DiscordToken string `yaml:"discordToken"`
	GithubToken  string `yaml:"githubToken"`
}

Config represents the configuration for the Discord bot.

func (*Config) AsRoleConfig added in v0.0.11

func (c *Config) AsRoleConfig() *common.RoleConfig

AsRoleConfig returns the role configuration.

type DiscordBot added in v0.0.11

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

DiscordBot represents the Discord bot implementation.

func (*DiscordBot) GetCartographoor added in v0.0.25

func (b *DiscordBot) GetCartographoor() *cartographoor.Service

GetCartographoor returns the cartographoor service.

func (*DiscordBot) GetChecksCmd added in v0.0.11

func (b *DiscordBot) GetChecksCmd() *cmdchecks.ChecksCommand

GetChecksCmd returns the checks command.

func (*DiscordBot) GetChecksRepo added in v0.0.11

func (b *DiscordBot) GetChecksRepo() *store.ChecksRepo

GetChecksRepo returns the checks repository.

func (*DiscordBot) GetGrafana added in v0.0.11

func (b *DiscordBot) GetGrafana() grafana.Client

GetGrafana returns the Grafana client.

func (*DiscordBot) GetHive added in v0.0.11

func (b *DiscordBot) GetHive() hive.Hive

GetHive returns the Hive client.

func (*DiscordBot) GetHiveSummaryRepo added in v0.0.13

func (b *DiscordBot) GetHiveSummaryRepo() *store.HiveSummaryRepo

GetHiveSummaryRepo returns the Hive summary repository.

func (*DiscordBot) GetMentionsRepo added in v0.0.11

func (b *DiscordBot) GetMentionsRepo() *store.MentionsRepo

GetMentionsRepo returns the mentions repository.

func (*DiscordBot) GetMonitorRepo added in v0.0.11

func (b *DiscordBot) GetMonitorRepo() *store.MonitorRepo

GetMonitorRepo returns the monitor repository.

func (*DiscordBot) GetQueues added in v0.0.11

func (b *DiscordBot) GetQueues() []queue.Queuer

GetQueues returns all queues managed by the bot.

func (*DiscordBot) GetRoleConfig added in v0.0.11

func (b *DiscordBot) GetRoleConfig() *common.RoleConfig

GetRoleConfig returns the role configuration.

func (*DiscordBot) GetScheduler added in v0.0.11

func (b *DiscordBot) GetScheduler() *scheduler.Scheduler

GetScheduler returns the scheduler.

func (*DiscordBot) GetSession added in v0.0.11

func (b *DiscordBot) GetSession() *discordgo.Session

GetSession returns the Discord session.

func (*DiscordBot) RefreshCommandChoices added in v0.0.26

func (b *DiscordBot) RefreshCommandChoices() error

RefreshCommandChoices refreshes the choices for all commands that support it.

func (*DiscordBot) SetCommands added in v0.0.11

func (b *DiscordBot) SetCommands(commands []common.Command)

SetCommands sets the commands for the bot.

func (*DiscordBot) Start added in v0.0.11

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

Start starts the bot.

func (*DiscordBot) Stop added in v0.0.11

func (b *DiscordBot) Stop(ctx context.Context) error

Stop stops the bot.

type Metrics added in v0.0.20

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

func NewMetrics added in v0.0.20

func NewMetrics(namespace string) *Metrics

func (*Metrics) ObserveCommandDuration added in v0.0.20

func (m *Metrics) ObserveCommandDuration(command, subcommand string, duration float64)

ObserveCommandDuration records the duration of a command execution.

func (*Metrics) RecordCommandError added in v0.0.20

func (m *Metrics) RecordCommandError(command, subcommand, errorType string)

RecordCommandError increments the command error counter.

func (*Metrics) RecordCommandExecution added in v0.0.20

func (m *Metrics) RecordCommandExecution(command, subcommand, username string)

RecordCommandExecution increments the command execution counter.

func (*Metrics) SetLastCommandTimestamp added in v0.0.20

func (m *Metrics) SetLastCommandTimestamp(command, subcommand string, timestamp float64)

SetLastCommandTimestamp sets the timestamp of the last command execution.

Directories

Path Synopsis
cmd
Package mock is a generated GoMock package.
Package mock is a generated GoMock package.

Jump to

Keyboard shortcuts

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