37 lines
906 B
Go
37 lines
906 B
Go
package handler
|
|
|
|
import (
|
|
"log"
|
|
|
|
"github.com/bwmarrin/discordgo"
|
|
)
|
|
|
|
func (h *router) Ping() CommandRoute {
|
|
return CommandRoute{
|
|
Command: discordgo.ApplicationCommand{
|
|
Name: "ping",
|
|
Description: "pongs in a reply",
|
|
},
|
|
Handler: func(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
|
|
|
err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
|
Type: discordgo.InteractionResponseChannelMessageWithSource,
|
|
Data: &discordgo.InteractionResponseData{
|
|
TTS: false,
|
|
Content: "Pong to: " + i.Member.User.Mention(),
|
|
Components: []discordgo.MessageComponent{},
|
|
Embeds: []*discordgo.MessageEmbed{},
|
|
Files: []*discordgo.File{},
|
|
Flags: 0,
|
|
Choices: []*discordgo.ApplicationCommandOptionChoice{},
|
|
CustomID: "",
|
|
Title: "",
|
|
},
|
|
})
|
|
if err != nil {
|
|
log.Println(err)
|
|
}
|
|
},
|
|
}
|
|
}
|