discord

package
v0.0.0-...-f0f3182 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2024 License: GPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Discord

type Discord struct {
	Session *discordgo.Session
	// contains filtered or unexported fields
}

Discord represents a thin wrapper around a Discord client.

func NewDiscord

func NewDiscord(token string, guildID string, applicationID string) (*Discord, error)

NewDiscord initializes the Discord client with a given token and guild identifier. It validates that the bot has the access it needs to function within the guild.

func (*Discord) Listen

func (d *Discord) Listen() error

Listen executes the core components of the Discord bot. It waits for interactions and subsequently acts on them.

func (*Discord) RegisterSlashCommand

func (d *Discord) RegisterSlashCommand(cmd *SlashCommand) error

RegisterSlashCommand associates a command with the server, ensuring it is created and subsequently deleted whenever the application stops.

type SlashCommand

type SlashCommand struct {
	Name        string
	Description string
	Options     []*discordgo.ApplicationCommandOption
	Handler     func(d *Discord, i *discordgo.InteractionCreate) error
}

SlashCommand is a custom struct definition for all slash command based interactions.

Jump to

Keyboard shortcuts

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