Skip to content

Commit

Permalink
i thought i already added that event handler lol
Browse files Browse the repository at this point in the history
  • Loading branch information
vaporvee committed Mar 12, 2024
1 parent 0e921bb commit ce6df11
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
.env
data.json
data.json

# Building
acecore
*.exe
9 changes: 9 additions & 0 deletions handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,15 @@ func ready(s *discordgo.Session, event *discordgo.Ready) {
fmt.Print("\nSuccessfully started the Bot!")
}

func guildCreate(s *discordgo.Session, event *discordgo.GuildCreate) {
for _, command := range commands {
_, err := s.ApplicationCommandCreate(s.State.User.ID, event.Guild.ID, &command.Definition)
if err != nil {
log.Printf("error creating command for guild %s: %v\n", event.Guild.Name, err)
}
}
}

func interactionCreate(s *discordgo.Session, i *discordgo.InteractionCreate) {
for _, command := range commands {
switch i.Type {
Expand Down
1 change: 1 addition & 0 deletions main.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ func main() {
}
bot.Identify.Intents = discordgo.IntentsGuildMessages | discordgo.IntentsGuilds | discordgo.IntentMessageContent | discordgo.IntentGuildMembers
bot.AddHandler(ready)
bot.AddHandler(guildCreate)
bot.AddHandler(interactionCreate)
bot.AddHandler(messageCreate)
bot.AddHandler(messageDelete)
Expand Down

0 comments on commit ce6df11

Please sign in to comment.