bb/command/ping.go
2022-07-26 09:30:17 -05:00

42 lines
922 B
Go

package command
import (
"strings"
"github.com/bwmarrin/discordgo"
log "github.com/sirupsen/logrus"
)
func PoopCommand(s *discordgo.Session, i *discordgo.InteractionCreate) {
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource,
Data: &discordgo.InteractionResponseData{
Content: "💩",
},
})
}
func PingCommand(s *discordgo.Session, i *discordgo.InteractionCreate) {
s.InteractionRespond(i.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseChannelMessageWithSource,
Data: &discordgo.InteractionResponseData{
Content: "Pong",
},
})
}
func PingHandler(s *discordgo.Session, m *discordgo.MessageCreate) {
if m.Author.ID == s.State.User.ID {
return
}
if !strings.HasPrefix(m.Content, "!ping") {
return
}
log.Debug("received ping")
s.ChannelMessageSend(m.ChannelID, "pong")
}