slash_commands

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2024 License: AGPL-3.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	GenericErrorResponseEmbedName  = ":x: Damn, something went wrong!"
	GenericErrorResponseEmbedValue = "Something unexpected happened while processing the command!"
)

Variables

This section is empty.

Functions

func EditResponse

EditResponse edits the passed interactions original response with the passed discordgo.WebhooKParams. This allows things like sending a notice that something will take some time and then edit the message to tell the user that the action has been done.

func GenerateEphemeralInteractionResponseTemplate

func GenerateEphemeralInteractionResponseTemplate(
	name string,
	description string,
) *discordgo.InteractionResponseData

GenerateEphemeralInteractionResponseTemplate creates a prefilled discordgo.InteractionResponseData that is prepared to be filled with specific data or errors. In addition, the discordgo.InteractionResponseData will be ephemeral and therefore only show to the user that triggered the interaction.

The template will get an empty embed with the specified name and description.

func GenerateInteractionResponseTemplate

func GenerateInteractionResponseTemplate(
	name string,
	description string,
) *discordgo.InteractionResponseData

GenerateInteractionResponseTemplate creates a prefilled discordgo.InteractionResponseData that is prepared to be filled with specific data or errors.

The template will get an empty embed with the specified name and description. The default color of the auto-generated embed equals the one defined under api.DefaultEmbedColor

func Respond

Respond to the target interaction with the passed discordgo.InteractionResponseData as a message in the channel where the interaction has been triggered.

func RespondWithCommandIsGuildOnly added in v0.2.0

func RespondWithCommandIsGuildOnly(
	c *api.Component,
	s *discordgo.Session,
	i *discordgo.InteractionCreate,
	commandName string,
)

RespondWithCommandIsGuildOnly responds with a message stating that the executed command is only available on guilds.

func RespondWithGenericErrorMessage added in v0.2.0

func RespondWithGenericErrorMessage(
	c *api.Component,
	s *discordgo.Session,
	i *discordgo.InteractionCreate,
	resp *discordgo.InteractionResponseData,
)

RespondWithGenericErrorMessage fills the passed discordgo.InteractionResponseData with a generic error message as content.

The prepared interaction response will be sent.

func RespondWithSimpleEmbedMessage added in v0.2.0

func RespondWithSimpleEmbedMessage(
	c *api.Component,
	s *discordgo.Session,
	i *discordgo.InteractionCreate,
	resp *discordgo.InteractionResponseData,
	header string,
	message string,
)

RespondWithSimpleEmbedMessage fills the passed discordgo.InteractionResponseData with an embed that contains a single field with a name and value.

The prepared interaction response will be sent.

Types

This section is empty.

Jump to

Keyboard shortcuts

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