mirror of
https://github.com/Xevion/banner.git
synced 2025-12-10 18:06:35 -06:00
list command names during registration
This commit is contained in:
8
main.go
8
main.go
@@ -14,6 +14,7 @@ import (
|
|||||||
"github.com/joho/godotenv"
|
"github.com/joho/godotenv"
|
||||||
"github.com/rs/zerolog"
|
"github.com/rs/zerolog"
|
||||||
"github.com/rs/zerolog/log"
|
"github.com/rs/zerolog/log"
|
||||||
|
"github.com/samber/lo"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -123,7 +124,12 @@ func main() {
|
|||||||
})
|
})
|
||||||
|
|
||||||
// Register commands with discord
|
// Register commands with discord
|
||||||
log.Info().Int("count", len(commandDefinitions)).Msg("Registering commands")
|
arr := zerolog.Arr()
|
||||||
|
lo.ForEach(commandDefinitions, func(cmd *discordgo.ApplicationCommand, _ int) {
|
||||||
|
arr.Str(cmd.Name)
|
||||||
|
})
|
||||||
|
log.Info().Array("commands", zerolog.Arr()).Msg("Registering commands")
|
||||||
|
|
||||||
registeredCommands := make([]*discordgo.ApplicationCommand, len(commandDefinitions))
|
registeredCommands := make([]*discordgo.ApplicationCommand, len(commandDefinitions))
|
||||||
for i, v := range commandDefinitions {
|
for i, v := range commandDefinitions {
|
||||||
cmd, err := session.ApplicationCommandCreate(session.State.User.ID, os.Getenv("BOT_TARGET_GUILD"), v)
|
cmd, err := session.ApplicationCommandCreate(session.State.User.ID, os.Getenv("BOT_TARGET_GUILD"), v)
|
||||||
|
|||||||
Reference in New Issue
Block a user