Add Command Functionality to Discord Package & Implement Feedback Webhooks

This commit is contained in:
2023-06-16 01:24:25 +00:00
parent 204803cd0b
commit 996155205d
10 changed files with 324 additions and 20 deletions

View File

@@ -24,6 +24,10 @@ func (discord *Discord) NewButton(id string, label string) *Button {
// OnClick registers an event when the button is clicked
func (button *Button) OnClick(action func(user common.User)) {
button.discord.session.AddHandler(func(s *discordgo.Session, r *discordgo.InteractionCreate) {
if r.Interaction.Type != discordgo.InteractionMessageComponent {
return
}
if r.MessageComponentData().CustomID == button.ID {
action(NewUser(r.Member.User))