Refactor: migrate discordbot
All checks were successful
All checks were successful
This commit is contained in:
32
bot/commands/ping.go
Normal file
32
bot/commands/ping.go
Normal file
@@ -0,0 +1,32 @@
|
||||
package commands
|
||||
|
||||
import (
|
||||
"gitea.konchin.com/go2025/backend/bot"
|
||||
"github.com/bwmarrin/discordgo"
|
||||
)
|
||||
|
||||
type PingCommand struct {
|
||||
bot *bot.Bot
|
||||
}
|
||||
|
||||
func NewPingCommand(bot *bot.Bot) bot.Command {
|
||||
return &PingCommand{bot: bot}
|
||||
}
|
||||
|
||||
func (self *PingCommand) ApplicationCommand() *discordgo.ApplicationCommand {
|
||||
return &discordgo.ApplicationCommand{
|
||||
Name: "ping",
|
||||
Description: "Check if bot is responsive",
|
||||
}
|
||||
}
|
||||
|
||||
func (self *PingCommand) Handler() bot.CommandHandler {
|
||||
return func(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