31 lines
615 B
Go
31 lines
615 B
Go
package handler
|
|
|
|
import (
|
|
"log"
|
|
|
|
"github.com/bwmarrin/discordgo"
|
|
)
|
|
|
|
func (c *client) Ping() Command {
|
|
return Command{
|
|
Command: discordgo.ApplicationCommand{
|
|
Name: "ping",
|
|
Description: "pongs in a reply",
|
|
},
|
|
Handler: c.ping,
|
|
}
|
|
}
|
|
|
|
func (c *client) ping(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
|
|
|
err := s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
|
|
Type: discordgo.InteractionResponseChannelMessageWithSource,
|
|
Data: &discordgo.InteractionResponseData{
|
|
Content: "Pong to: " + i.Member.User.Mention(),
|
|
},
|
|
})
|
|
if err != nil {
|
|
log.Println(err)
|
|
}
|
|
}
|