commands

package
v0.0.0-...-1520e54 Latest Latest
Warning

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

Go to latest
Published: Nov 1, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Echo = slash.Command{
	ApplicationCommand: &discordgo.ApplicationCommand{
		Name:        "echo",
		Description: "Echos text",
		Type:        discordgo.ChatApplicationCommand,
		Options: []*discordgo.ApplicationCommandOption{
			{
				Type:        discordgo.ApplicationCommandOptionString,
				Name:        "text",
				Description: "The text you want to echo",
				Required:    true,
			},
		},
	},
	Middlewares: []slash.Middleware{slash.IsAdmin},
	Handler: func(ctx *slash.Context) error {
		text := ctx.ApplicationCommandData().Options[0].StringValue()
		if err := ctx.InteractionRespond(ctx.Interaction, &discordgo.InteractionResponse{
			Type: discordgo.InteractionResponseChannelMessageWithSource,
			Data: &discordgo.InteractionResponseData{
				Flags:   64,
				Content: fmt.Sprintf("Echoed `%s`", text),
			},
		}); err != nil {
			return err
		}
		_, err := ctx.ChannelMessageSend(ctx.ChannelID, text)
		return err
	},
}
View Source
var Log = slash.Command{
	ApplicationCommand: &discordgo.ApplicationCommand{
		Name:        "log",
		Description: "Interact with logs",
		Type:        discordgo.ChatApplicationCommand,
		Options: []*discordgo.ApplicationCommandOption{
			{
				Type:        discordgo.ApplicationCommandOptionSubCommand,
				Name:        "add",
				Description: "Add a log",
				Required:    false,
			},
			{
				Type:        discordgo.ApplicationCommandOptionSubCommand,
				Name:        "remove",
				Description: "Remove a log",
				Required:    false,
			},
			{
				Type:        discordgo.ApplicationCommandOptionSubCommand,
				Name:        "edit",
				Description: "Add a log",
				Required:    false,
			},
		},
	},
	Middlewares: []slash.Middleware{slash.IsAdmin},
	Handler: func(context *slash.Context) error {
		return nil
	},
}
View Source
var Ping = slash.Command{
	ApplicationCommand: &discordgo.ApplicationCommand{
		Name:        "ping",
		Description: "Pings the bot",
		Type:        discordgo.ChatApplicationCommand,
	},
	Handler: func(ctx *slash.Context) error {
		err := ctx.InteractionRespond(ctx.Interaction, &discordgo.InteractionResponse{
			Type: discordgo.InteractionResponseChannelMessageWithSource,
			Data: &discordgo.InteractionResponseData{
				Flags:   64,
				Content: fmt.Sprintf("Pong %dms!", ctx.HeartbeatLatency()/time.Millisecond),
			},
		})
		return err
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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