Skip to content

Commit

Permalink
templates: add stickers to complexMessage (#1768)
Browse files Browse the repository at this point in the history
Signed-off-by: SoggySaussages <[email protected]>
  • Loading branch information
SoggySaussages authored Nov 20, 2024
1 parent 62a6c62 commit 9623ea3
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions common/templates/general.go
Original file line number Diff line number Diff line change
Expand Up @@ -431,6 +431,19 @@ func CreateMessageSend(values ...interface{}) (*discordgo.MessageSend, error) {
}
msg.Components = append(msg.Components, discordgo.ActionsRow{[]discordgo.MessageComponent{menu}})
}
case "sticker":
if val == nil {
continue
}
v, _ := indirect(reflect.ValueOf(val))
if v.Kind() == reflect.Slice {
const maxStickers = 3 // Discord limitation
for i := 0; i < v.Len() && i < maxStickers; i++ {
msg.StickerIDs = append(msg.StickerIDs, ToInt64(v.Index(i).Interface()))
}
} else {
msg.StickerIDs = append(msg.StickerIDs, ToInt64(val))
}
default:
return nil, errors.New(`invalid key "` + key + `" passed to send message builder`)
}
Expand Down

0 comments on commit 9623ea3

Please sign in to comment.