-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomponent.go
More file actions
31 lines (25 loc) · 892 Bytes
/
Copy pathcomponent.go
File metadata and controls
31 lines (25 loc) · 892 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package main
import (
"github.com/bwmarrin/discordgo"
)
const (
bugReportButtonID = "report_btn"
)
// This takes care of the slash command and interactions for the button that can be setup
func handleInteractions(session *discordgo.Session, interaction *discordgo.InteractionCreate) {
switch interaction.Type {
case discordgo.InteractionMessageComponent:
if interaction.MessageComponentData().CustomID != bugReportButtonID {
return
}
// From here we should always respond to Discord that we at least received the event and handled it accordingly
defer session.InteractionRespond(interaction.Interaction, &discordgo.InteractionResponse{
Type: discordgo.InteractionResponseDeferredMessageUpdate,
})
if interaction.Member == nil {
return
}
// Handle the bug button click!
go startNewReportConversation(interaction.Member.User.ID, interaction.ChannelID)
}
}