command

package
v0.0.0-...-c9ef3b4 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterGuildCommand

func RegisterGuildCommand(l *slog.Logger, s *discordgo.Session, c Command)

RegisterGuildCommand creates a guild level application command when a guild create event is dispatched. The underlying API call is an upsert and safe to call multiple times.

func RegisterInteractionCreate

func RegisterInteractionCreate(l *slog.Logger, s *discordgo.Session, command InteractionCreate)

RegisterInteractionCreate registers the command to be called during an interaction create event

Types

type Command

type Command interface {
	// Name of application command to display in UI
	Name() string

	// Description of application command to display in UI
	Description() string
}

Command represents a Discord Application Command https://discord.com/developers/docs/interactions/application-commands

type InteractionCreate

type InteractionCreate interface {
	Command

	// Run is called each time an InteractionCreate event is dispatched that matches the command name
	Run(*slog.Logger, *discordgo.Session, *discordgo.InteractionCreate) error
}

InteractionCreate is the initial event when an interaction begins from discord https://discord.com/developers/docs/interactions/receiving-and-responding#receiving-an-interaction

Jump to

Keyboard shortcuts

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