3
0
Fork 0
mirror of https://github.com/ZeppelinBot/Zeppelin.git synced 2025-03-16 22:21:51 +00:00

Return some rate limit fiddling for reaction roles

This commit is contained in:
Dragory 2020-08-02 00:23:14 +03:00
parent 08524dee58
commit b4b16d0d88
No known key found for this signature in database
GPG key ID: 5F387BA66DF8AAC1

View file

@ -43,6 +43,7 @@ export async function applyReactionRoleReactionsToMessage(
// Remove old reactions, if any // Remove old reactions, if any
await targetMessage.removeReactions(); await targetMessage.removeReactions();
await sleep(1500);
// Add reaction role reactions // Add reaction role reactions
for (const rr of reactionRoles) { for (const rr of reactionRoles) {
@ -50,6 +51,7 @@ export async function applyReactionRoleReactionsToMessage(
try { try {
await targetMessage.addReaction(emoji); await targetMessage.addReaction(emoji);
await sleep(1250); // Make sure we don't hit rate limits
} catch (e) { } catch (e) {
if (isDiscordRESTError(e) && e.code === 10014) { if (isDiscordRESTError(e) && e.code === 10014) {
pluginData.state.reactionRoles.removeFromMessage(messageId, rr.emoji); pluginData.state.reactionRoles.removeFromMessage(messageId, rr.emoji);