mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-05-22 07:11:16 +00:00
API: stay within the boundaries of messageIDs (#160)
This commit is contained in:
parent
cc1975988d
commit
456692da93
|
@ -347,9 +347,10 @@ func (c *Client) DeleteMessages(channelID discord.ChannelID, messageIDs []discor
|
|||
return c.deleteMessages(channelID, messageIDs)
|
||||
}
|
||||
|
||||
// If the number of messages to be deleted exceeds the amount discord is willing
|
||||
// to accept at one time then batches of messages will be deleted
|
||||
for start := 0; start < len(messageIDs); start += maxMessageDeleteLimit {
|
||||
end := min(len(messageIDs), maxMessageDeleteLimit)
|
||||
|
||||
end := min(len(messageIDs), start+maxMessageDeleteLimit)
|
||||
err := c.deleteMessages(channelID, messageIDs[start:end])
|
||||
if err != nil {
|
||||
return err
|
||||
|
|
Loading…
Reference in a new issue