Skip to content

Commit 95a31f4

Browse files
committed
chore(Secret Santa): cleanup of getting current player
1 parent 64e4a79 commit 95a31f4

6 files changed

+127
-250
lines changed

modules/secretsanta/component.go

+13-3
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,22 @@ func (c Component) HandleModal(s *discordgo.Session, i *discordgo.InteractionCre
5959
// pop the first level identifier
6060
util.ShiftL(ids)
6161

62-
switch util.ShiftL(ids) {
62+
modalID := util.ShiftL(ids)
63+
c.Interaction.GuildID = util.ShiftL(ids)
64+
if c.Interaction.GuildID != "" {
65+
if err := c.getPlayer(); err != nil {
66+
log.Printf("ERROR: could not get player: %+v", err)
67+
c.ReplyError()
68+
return
69+
}
70+
}
71+
72+
switch modalID {
6373
case "set_address":
64-
c.handleModalSetAddress(ids)
74+
c.handleModalSetAddress()
6575
return
6676
case "add_package_tracking":
67-
c.handleModalAddPackageTracking(ids)
77+
c.handleModalAddPackageTracking()
6878
return
6979
default:
7080
log.Printf("Unknown modal submit ID: %s", c.modal.CustomID)

0 commit comments

Comments
 (0)