i thought i already added that event handler lol
This commit is contained in:
4
.gitignore
vendored
4
.gitignore
vendored
@@ -1,2 +1,6 @@
|
|||||||
.env
|
.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!")
|
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) {
|
func interactionCreate(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||||
for _, command := range commands {
|
for _, command := range commands {
|
||||||
switch i.Type {
|
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.Identify.Intents = discordgo.IntentsGuildMessages | discordgo.IntentsGuilds | discordgo.IntentMessageContent | discordgo.IntentGuildMembers
|
||||||
bot.AddHandler(ready)
|
bot.AddHandler(ready)
|
||||||
|
bot.AddHandler(guildCreate)
|
||||||
bot.AddHandler(interactionCreate)
|
bot.AddHandler(interactionCreate)
|
||||||
bot.AddHandler(messageCreate)
|
bot.AddHandler(messageCreate)
|
||||||
bot.AddHandler(messageDelete)
|
bot.AddHandler(messageDelete)
|
||||||
|
Reference in New Issue
Block a user