Documentation ¶
Index ¶
- Constants
- Variables
- func CheckRole(roles []string, requiredRole string) bool
- func DeferredMessage() (discordgo.InteractionResponse, error)
- func SendDeferredMessage(appID string, token string, content string, opts ...Option) error
- func SendDeferredMessageWithComponents(appID string, token string, content string, opts ...Option) error
- type Command
- type Option
Constants ¶
View Source
const ( DiscordBaseURL = "https://discord.com/api" ErrMissingRole = "You don't have the required role to use this command!" )
Variables ¶
View Source
var ( Commands = map[string]Command{ "ping": { Command: discordgo.ApplicationCommand{ Name: "ping", Description: "Pong!", }, Handler: ping, Options: nil, }, "pixelmon": { Command: discordgo.ApplicationCommand{ Name: "pixelmon", Description: "Pixelmon command", Options: []*discordgo.ApplicationCommandOption{ { Type: discordgo.ApplicationCommandOptionSubCommand, Name: "status", Description: "Get the status of the Pixelmon server", }, { Type: discordgo.ApplicationCommandOptionSubCommand, Name: "start", Description: "Starts the Pixelmon server", }, { Type: discordgo.ApplicationCommandOptionSubCommand, Name: "stop", Description: "Stops the Pixelmon server", }, { Type: discordgo.ApplicationCommandOptionSubCommand, Name: "say", Description: "Sends a message to the Pixelmon server", Options: []*discordgo.ApplicationCommandOption{ { Type: discordgo.ApplicationCommandOptionString, Name: "message", Description: "Message to send to the Pixelmon server", Required: true, }, }, }, { Type: discordgo.ApplicationCommandOptionSubCommand, Name: "whitelist", Description: "Adds a user to the whitelist of the Pixelmon server", Options: []*discordgo.ApplicationCommandOption{ { Type: discordgo.ApplicationCommandOptionString, Name: "username", Description: "Minecraft username to whitelist", Required: true, }, }, }, }, }, Handler: nil, Options: map[string]func(*discordgo.Interaction, ...Option) (string, error){ "status": status, "start": start, "stop": stop, "say": say, "whitelist": whitelist, }, }, "partyfinder": { Command: discordgo.ApplicationCommand{ Name: "partyfinder", Description: "Party Finder command", Options: []*discordgo.ApplicationCommandOption{ { Type: discordgo.ApplicationCommandOptionString, Name: "description", Description: "Description of the event", Required: true, }, { Type: discordgo.ApplicationCommandOptionInteger, Name: "size", Description: "Group Size", Required: false, }, { Type: discordgo.ApplicationCommandOptionString, Name: "partycomp", Description: "Party Composition", Required: false, }, { Type: discordgo.ApplicationCommandOptionString, Name: "date", Description: "Event's start date", Required: false, }, }, }, Handler: partyfinder, Options: nil, }, } )
Functions ¶
func DeferredMessage ¶
func DeferredMessage() (discordgo.InteractionResponse, error)
func SendDeferredMessage ¶
Types ¶
type Command ¶
type Command struct { Command discordgo.ApplicationCommand Handler func(*discordgo.Interaction, ...Option) (string, error) Options map[string]func(*discordgo.Interaction, ...Option) (string, error) }
Click to show internal directories.
Click to hide internal directories.