i thought i already added that event handler lol
This commit is contained in:
6
.gitignore
vendored
6
.gitignore
vendored
@@ -1,2 +1,6 @@
|
||||
.env
|
||||
data.json
|
||||
data.json
|
||||
|
||||
# Building
|
||||
acecore
|
||||
*.exe
|
@@ -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 {
|
||||
|
1
main.go
1
main.go
@@ -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)
|
||||
|
Reference in New Issue
Block a user