Skip to content

Commit

Permalink
chore(Secret Santa): cleanup of getting current player
Browse files Browse the repository at this point in the history
  • Loading branch information
Kesuaheli committed Dec 21, 2024
1 parent 64e4a79 commit 95a31f4
Show file tree
Hide file tree
Showing 6 changed files with 127 additions and 250 deletions.
16 changes: 13 additions & 3 deletions modules/secretsanta/component.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,12 +59,22 @@ func (c Component) HandleModal(s *discordgo.Session, i *discordgo.InteractionCre
// pop the first level identifier
util.ShiftL(ids)

switch util.ShiftL(ids) {
modalID := util.ShiftL(ids)
c.Interaction.GuildID = util.ShiftL(ids)
if c.Interaction.GuildID != "" {
if err := c.getPlayer(); err != nil {
log.Printf("ERROR: could not get player: %+v", err)
c.ReplyError()
return
}
}

switch modalID {
case "set_address":
c.handleModalSetAddress(ids)
c.handleModalSetAddress()
return
case "add_package_tracking":
c.handleModalAddPackageTracking(ids)
c.handleModalAddPackageTracking()
return
default:
log.Printf("Unknown modal submit ID: %s", c.modal.CustomID)
Expand Down
Loading

0 comments on commit 95a31f4

Please sign in to comment.