Return some rate limit fiddling for reaction roles
This commit is contained in:
parent
08524dee58
commit
b4b16d0d88
1 changed files with 2 additions and 0 deletions
|
@ -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);
|
||||||
|
|
Loading…
Add table
Reference in a new issue