Documentation ¶
Index ¶
- Constants
- Variables
- func BusySleep()
- func CheckForAdmin(s *discordgo.Session, i *discordgo.InteractionCreate) bool
- func CheckForRoles(s *discordgo.Session, i *discordgo.InteractionCreate, roles ...string) bool
- func CheckForRolesOrAdmin(s *discordgo.Session, i *discordgo.InteractionCreate, roles ...string) bool
- func InitFramework(debugMode bool, testingGuildId string, botToken string) *discordgo.Session
- func RegisterButtonHandlerWithFramework(handler ButtonHandler)
- func RegisterButtonHandlersWithFramework(handlers []ButtonHandler)
- func RegisterSlashCommandWithFramework(command SlashCommand)
- func RegisterSlashCommandsWithFramework(commands []SlashCommand)
- func ReleaseSystem()
- func SendDeferResponse(s *discordgo.Session, i *discordgo.InteractionCreate)
- func SendEphemeralEmbed(s *discordgo.Session, i *discordgo.InteractionCreate, ...)
- func SendEphemeralResponse(s *discordgo.Session, i *discordgo.InteractionCreate, msg string)
- func ShutdownFramework()
- func StartFramework()
- func TryAcquireSystem() bool
- type BooleanOption
- type ButtonHandler
- type ChannelOption
- type CommandOption
- type FloatOption
- type IntegerOption
- type OptionContainer
- type OptionRequirement
- type RoleOption
- type SlashCommand
- type StringOption
- type UnsignedIntergerOption
- type UserOption
Constants ¶
const (
EphemeralFlag = 64
)
Variables ¶
var ( ErrInvalidOptionType = errors.New("invalid option type") ErrMissingRequiredOption = errors.New("missing required option") )
declare errors
Functions ¶
func BusySleep ¶
func BusySleep()
busySleep pauses execution for up to 10 seconds if the system is busy
func CheckForAdmin ¶ added in v0.1.13
func CheckForAdmin(s *discordgo.Session, i *discordgo.InteractionCreate) bool
func CheckForRoles ¶
checkForRoles checks if a member has one of the provided roles
func CheckForRolesOrAdmin ¶ added in v0.1.13
func InitFramework ¶
Initializes the framework and returns a discord session, needed for the other functions
func RegisterButtonHandlerWithFramework ¶
func RegisterButtonHandlerWithFramework(handler ButtonHandler)
Registers a button handler with the framework
func RegisterButtonHandlersWithFramework ¶ added in v0.1.3
func RegisterButtonHandlersWithFramework(handlers []ButtonHandler)
Registers multiple button handlers with the framework
func RegisterSlashCommandWithFramework ¶
func RegisterSlashCommandWithFramework(command SlashCommand)
Registers a slash command with the framework
func RegisterSlashCommandsWithFramework ¶ added in v0.1.3
func RegisterSlashCommandsWithFramework(commands []SlashCommand)
Registers multiple slash commands with the framework
func ReleaseSystem ¶
func ReleaseSystem()
Set systemBusy to false. Should be deferred after a successful tryAcquireSystem.
func SendDeferResponse ¶
func SendDeferResponse(s *discordgo.Session, i *discordgo.InteractionCreate)
sendDeferResponse sends a deferred response to an interaction
func SendEphemeralEmbed ¶ added in v0.1.4
func SendEphemeralEmbed(s *discordgo.Session, i *discordgo.InteractionCreate, embed *discordgo.MessageEmbed)
func SendEphemeralResponse ¶
func SendEphemeralResponse(s *discordgo.Session, i *discordgo.InteractionCreate, msg string)
sendEphemeralResponse sends a response to an interaction that only the user can see
func ShutdownFramework ¶
func ShutdownFramework()
Shuts down the framework and closes the discord session
func StartFramework ¶
func StartFramework()
Launches the framework and registers all commands and handlers
func TryAcquireSystem ¶
func TryAcquireSystem() bool
Check if the system is busy. If not, set it to busy and return true. If it is busy, return false.
Types ¶
type BooleanOption ¶ added in v0.1.6
func (BooleanOption) GetName ¶ added in v0.1.6
func (s BooleanOption) GetName() string
func (BooleanOption) GetValue ¶ added in v0.1.6
func (s BooleanOption) GetValue() any
type ButtonHandler ¶
type ChannelOption ¶ added in v0.1.6
func (ChannelOption) GetName ¶ added in v0.1.6
func (s ChannelOption) GetName() string
func (ChannelOption) GetValue ¶ added in v0.1.6
func (s ChannelOption) GetValue() any
type CommandOption ¶ added in v0.1.6
type FloatOption ¶ added in v0.1.6
func (FloatOption) GetName ¶ added in v0.1.6
func (s FloatOption) GetName() string
func (FloatOption) GetValue ¶ added in v0.1.6
func (s FloatOption) GetValue() any
type IntegerOption ¶ added in v0.1.6
func (IntegerOption) GetName ¶ added in v0.1.6
func (s IntegerOption) GetName() string
func (IntegerOption) GetValue ¶ added in v0.1.6
func (s IntegerOption) GetValue() any
type OptionContainer ¶ added in v0.1.6
type OptionContainer struct {
Options map[string]CommandOption
}
type OptionRequirement ¶ added in v0.1.6
type OptionRequirement struct { Required bool Name string Description string Type discordgo.ApplicationCommandOptionType Default CommandOption }
type RoleOption ¶ added in v0.1.6
func (RoleOption) GetName ¶ added in v0.1.6
func (s RoleOption) GetName() string
func (RoleOption) GetValue ¶ added in v0.1.6
func (s RoleOption) GetValue() any
type SlashCommand ¶ added in v0.1.4
type SlashCommand struct { Name string Description string Handler func(s *discordgo.Session, i *discordgo.InteractionCreate, options *OptionContainer) RequiredOptions []OptionRequirement // contains filtered or unexported fields }
type StringOption ¶ added in v0.1.6
func (StringOption) GetName ¶ added in v0.1.6
func (s StringOption) GetName() string
func (StringOption) GetValue ¶ added in v0.1.6
func (s StringOption) GetValue() any
type UnsignedIntergerOption ¶ added in v0.1.6
func (UnsignedIntergerOption) GetName ¶ added in v0.1.6
func (s UnsignedIntergerOption) GetName() string
func (UnsignedIntergerOption) GetValue ¶ added in v0.1.6
func (s UnsignedIntergerOption) GetValue() any
type UserOption ¶ added in v0.1.6
func (UserOption) GetName ¶ added in v0.1.6
func (s UserOption) GetName() string
func (UserOption) GetValue ¶ added in v0.1.6
func (s UserOption) GetValue() any