Initial Commit
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"velox-bot/internal/commands/fun"
|
||||
|
||||
"github.com/bwmarrin/discordgo"
|
||||
)
|
||||
|
||||
var AllCommands = []*discordgo.ApplicationCommand{
|
||||
fun.PingCommand,
|
||||
}
|
||||
|
||||
var handlers = map[string]func(s *discordgo.Session, i *discordgo.InteractionCreate){
|
||||
"ping": fun.HandlePing,
|
||||
}
|
||||
|
||||
func HandleInteraction(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||
if h, ok := handlers[i.ApplicationCommandData().Name]; ok {
|
||||
h(s, i)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
package fun
|
||||
|
||||
import "github.com/bwmarrin/discordgo"
|
||||
|
||||
var PingCommand = &discordgo.ApplicationCommand{
|
||||
Name: "ping",
|
||||
Description: "Ping the bot",
|
||||
}
|
||||
|
||||
func HandlePing(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
||||
Type: discordgo.InteractionResponseChannelMessageWithSource,
|
||||
Data: &discordgo.InteractionResponseData{
|
||||
Content: "Pong!",
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user