Documentation
¶
Index ¶
- func GetRoleNames(member *discordgo.Member, session *discordgo.Session, guildID string) []string
- func HasPermission(member *discordgo.Member, session *discordgo.Session, guildID string, ...) bool
- func NoPermissionError(command string) error
- type AutocompleteHandler
- type BotContext
- type Command
- type RoleConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetRoleNames ¶ added in v0.0.22
GetRoleNames returns the plain-english names of the roles a member has.
func HasPermission ¶
func HasPermission(member *discordgo.Member, session *discordgo.Session, guildID string, config *RoleConfig, cmdData *discordgo.ApplicationCommandInteractionData) bool
HasPermission checks if a member has permission to execute a command.
func NoPermissionError ¶
NoPermissionError returns a formatted error message for permission denied.
Types ¶
type AutocompleteHandler ¶ added in v0.0.27
type AutocompleteHandler struct {
// contains filtered or unexported fields
}
AutocompleteHandler handles network autocomplete for Discord commands.
func NewAutocompleteHandler ¶ added in v0.0.27
func NewAutocompleteHandler(bot BotContext, log *logrus.Logger) *AutocompleteHandler
NewAutocompleteHandler creates a new autocomplete handler.
func (*AutocompleteHandler) HandleNetworkAutocomplete ¶ added in v0.0.27
func (h *AutocompleteHandler) HandleNetworkAutocomplete(s *discordgo.Session, i *discordgo.InteractionCreate, commandName string)
HandleNetworkAutocomplete handles autocomplete for network selection. It returns active networks first (alphabetically sorted), followed by inactive networks.
type BotContext ¶
type BotContext interface {
// GetSession returns the Discord session.
GetSession() *discordgo.Session
// GetScheduler returns the scheduler.
GetScheduler() *scheduler.Scheduler
// GetMonitorRepo returns the monitor repository.
GetMonitorRepo() *store.MonitorRepo
// GetChecksRepo returns the checks repository.
GetChecksRepo() *store.ChecksRepo
// GetMentionsRepo returns the mentions repository.
GetMentionsRepo() *store.MentionsRepo
// GetHiveSummaryRepo returns the Hive summary repository.
GetHiveSummaryRepo() *store.HiveSummaryRepo
// GetGrafana returns the Grafana client.
GetGrafana() grafana.Client
// GetHive returns the Hive client.
GetHive() hive.Hive
// GetCartographoor returns the cartographoor service.
GetCartographoor() *cartographoor.Service
// GetRoleConfig returns the role configuration.
GetRoleConfig() *RoleConfig
}
BotContext provides access to bot functionality needed by commands.
type Command ¶
type Command interface {
// Name returns the name of the command.
Name() string
// Register registers the command with the given session.
Register(*discordgo.Session) error
// Handle handles the command.
Handle(*discordgo.Session, *discordgo.InteractionCreate)
}
Command represents a Discord slash command.
Click to show internal directories.
Click to hide internal directories.