Files
self-bot/Bot/register.go
T

36 lines
805 B
Go
Raw Normal View History

2025-03-23 13:38:56 -04:00
package bot
import (
"log"
Commands "ion606_bot/Bot/Commands"
helpers "ion606_bot/Bot/Helpers"
"github.com/bwmarrin/discordgo"
)
var commandsList = []*discordgo.ApplicationCommand{
Commands.MeowCommand,
Commands.PurrCommand,
Commands.BoopCommand,
Commands.HugCommand,
Commands.CuddleCommand,
Commands.SnuggleCommand,
Commands.CatfactCommand,
2025-03-24 16:34:59 -04:00
Commands.AnimalGifCommand,
Commands.ActionCommand,
2025-03-23 13:38:56 -04:00
}
func RegisterCommands(s *discordgo.Session, guildID string) {
for _, cmd := range commandsList {
_, err := s.ApplicationCommandCreate(s.State.User.ID, guildID, cmd)
if err != nil {
log.Printf("Cannot create '%v' command: %v", cmd.Name, err)
// Handle error using HandleError
helpers.HandleError(s, nil, err)
} else {
log.Printf("Registered command: %v", cmd.Name)
}
}
}