Documentation
¶
Index ¶
- type Bot
- type BotCore
- type BotServices
- type Config
- type DiscordBot
- func (b *DiscordBot) GetCartographoor() *cartographoor.Service
- func (b *DiscordBot) GetChecksCmd() *cmdchecks.ChecksCommand
- func (b *DiscordBot) GetChecksRepo() *store.ChecksRepo
- func (b *DiscordBot) GetGrafana() grafana.Client
- func (b *DiscordBot) GetHive() hive.Hive
- func (b *DiscordBot) GetHiveSummaryRepo() *store.HiveSummaryRepo
- func (b *DiscordBot) GetMentionsRepo() *store.MentionsRepo
- func (b *DiscordBot) GetMonitorRepo() *store.MonitorRepo
- func (b *DiscordBot) GetQueues() []queue.Queuer
- func (b *DiscordBot) GetRoleConfig() *common.RoleConfig
- func (b *DiscordBot) GetScheduler() *scheduler.Scheduler
- func (b *DiscordBot) GetSession() *discordgo.Session
- func (b *DiscordBot) RefreshCommandChoices() error
- func (b *DiscordBot) SetCommands(commands []common.Command)
- func (b *DiscordBot) Start(ctx context.Context) error
- func (b *DiscordBot) Stop(ctx context.Context) error
- type Metrics
- func (m *Metrics) ObserveCommandDuration(command, subcommand string, duration float64)
- func (m *Metrics) RecordCommandError(command, subcommand, errorType string)
- func (m *Metrics) RecordCommandExecution(command, subcommand, username string)
- func (m *Metrics) SetLastCommandTimestamp(command, subcommand string, timestamp float64)
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"`
GuildID string `yaml:"guildId"` // Optional: if set, commands will be registered to this guild only
}
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.
type Metrics ¶ added in v0.0.20
type Metrics struct {
// contains filtered or unexported fields
}
func NewMetrics ¶ added in v0.0.20
func (*Metrics) ObserveCommandDuration ¶ added in v0.0.20
ObserveCommandDuration records the duration of a command execution.
func (*Metrics) RecordCommandError ¶ added in v0.0.20
RecordCommandError increments the command error counter.
func (*Metrics) RecordCommandExecution ¶ added in v0.0.20
RecordCommandExecution increments the command execution counter.
func (*Metrics) SetLastCommandTimestamp ¶ added in v0.0.20
SetLastCommandTimestamp sets the timestamp of the last command execution.