disgoorg / disgo

A modular Golang Discord API Wrapper
Apache License 2.0
333 stars 37 forks source link

Implement an Embed chunker #389

Closed SkyzerFlyzer closed 1 month ago

SkyzerFlyzer commented 1 month ago

Is your feature request related to a problem? Please describe. When sending a webhook message, you can only send 10 embeds at a time as per discord's api specification. If the goal of the wrapper is to be more high level than other wrappers I believe it should take into account how many embeds that it is trying to send and if it is more than 10 chunk them and call the endpoint several times

Describe the solution you'd like I would like any function that sends embeds via a webhook to chunk the embed slices into chunks of 10 then send each set of 10

Describe alternatives you've considered It may be that you want the user to do this chunking, this way you should probably do a precheck for the user and return an error along the line of Too many embeds to send, the maximum number of embeds you can send at once is 10

Additional context Webhook Execute specification

sebm253 commented 1 month ago

hi, this leans into the realm of payload validation, which was planned but remains in the backlog due to its complexity at this point, and also a utility of some sort which in my opinion does not make sense to have in the library itself - maybe as an external utility (chunking embeds, content, whatever). since Go 1.23 there's a helper for just this - slices.Chunk

@topi314 what do you think?

topi314 commented 1 month ago

+1 what @sebm253 said