v0.2
This commit is contained in:
@@ -24,6 +24,8 @@ func (r *Router) Handle(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||
r.routeCommand(s, i)
|
||||
case discordgo.InteractionMessageComponent:
|
||||
r.routeComponent(s, i)
|
||||
case discordgo.InteractionModalSubmit:
|
||||
r.routeModal(s, i)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +66,17 @@ func (r *Router) routeComponent(s *discordgo.Session, i *discordgo.InteractionCr
|
||||
}
|
||||
}
|
||||
|
||||
func (r *Router) routeModal(s *discordgo.Session, i *discordgo.InteractionCreate) {
|
||||
customID := i.ModalSubmitData().CustomID
|
||||
slog.Debug("modal received", "custom_id", customID, "user_id", memberUserID(i))
|
||||
switch {
|
||||
case strings.HasPrefix(customID, "modal:ticket:"):
|
||||
r.PanelComp.HandleModalSubmit(s, i)
|
||||
default:
|
||||
slog.Warn("unknown modal", "custom_id", customID)
|
||||
}
|
||||
}
|
||||
|
||||
func memberUserID(i *discordgo.InteractionCreate) string {
|
||||
if i.Member != nil && i.Member.User != nil {
|
||||
return i.Member.User.ID
|
||||
|
||||
Reference in New Issue
Block a user