discord

package
v0.0.0-...-37323cf Latest Latest
Warning

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

Go to latest
Published: May 30, 2024 License: MIT Imports: 12 Imported by: 0

Documentation

Index

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{
		"coinflip": {
			Command: discordgo.ApplicationCommand{
				Name:        "coinflip",
				Description: "Flip a coin",
			},
			Handler: coinflip,
			Options: nil,
		},
		"ping": {
			Command: discordgo.ApplicationCommand{
				Name:        "ping",
				Description: "Pong!",
			},
			Handler: ping,
			Options: nil,
		},

		"roll": {
			Command: discordgo.ApplicationCommand{
				Name:        "roll",
				Description: "Roll the dice",
				Options: []*discordgo.ApplicationCommandOption{
					{
						Type:        discordgo.ApplicationCommandOptionString,
						Name:        "dice",
						Description: "Amount of dice to roll plus modifiers",
						Required:    true,
					},
				},
			},
			Handler: roll,
			Options: nil,
		},
	}
)
View Source
var (
	ServerURL = fmt.Sprintf("%v.%v", os.Getenv("PIXELMON_SUBDOMAIN"), os.Getenv("PIXELMON_DOMAIN"))
)

Functions

func CheckRole

func CheckRole(roles []string, requiredRole string) bool

func DeferredMessage

func DeferredMessage() (discordgo.InteractionResponse, error)

func SendDeferredMessage

func SendDeferredMessage(appID string, token string, content string, opts ...Option) error

func SendDeferredMessageWithComponents

func SendDeferredMessageWithComponents(appID string, token string, content string, opts ...Option) error

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)
}

type Option

type Option func(*options)

func WithActionsRow

func WithActionsRow(actionsRow *discordgo.ActionsRow) Option

func WithClient

func WithClient(client *http.Client) Option

func WithURL

func WithURL(url string) Option

Jump to

Keyboard shortcuts

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