|
|
|
@ -7,8 +7,8 @@ import sx.blah.discord.api.IDiscordClient;
|
|
|
|
|
import sx.blah.discord.handle.obj.IChannel;
|
|
|
|
|
import sx.blah.discord.handle.obj.IMessage;
|
|
|
|
|
import sx.blah.discord.util.DiscordException;
|
|
|
|
|
import sx.blah.discord.util.HTTP429Exception;
|
|
|
|
|
import sx.blah.discord.util.MissingPermissionsException;
|
|
|
|
|
import sx.blah.discord.util.RateLimitException;
|
|
|
|
|
import java.util.Optional;
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
@ -36,7 +36,7 @@ public class DiscordInteractionsUtil
|
|
|
|
|
* Retry policy for sending a message
|
|
|
|
|
*/
|
|
|
|
|
private static final RetryPolicy MESSAGE_RETRY_POLICY = new RetryPolicy()
|
|
|
|
|
.retryOn(HTTP429Exception.class, DiscordException.class)
|
|
|
|
|
.retryOn(RateLimitException.class, DiscordException.class)
|
|
|
|
|
.withDelay(GW_RETRY_DELAY, TimeUnit.SECONDS)
|
|
|
|
|
.withMaxRetries(MAX_GW_RETRIES)
|
|
|
|
|
.abortOn(MissingPermissionsException.class);
|
|
|
|
@ -72,7 +72,7 @@ public class DiscordInteractionsUtil
|
|
|
|
|
* Policy for a gateway disconnection
|
|
|
|
|
*/
|
|
|
|
|
private static final RetryPolicy GW_LOGOUT_POLICY = new RetryPolicy()
|
|
|
|
|
.retryOn(HTTP429Exception.class, DiscordException.class)
|
|
|
|
|
.retryOn(RateLimitException.class, DiscordException.class)
|
|
|
|
|
.withDelay(GW_RETRY_DELAY, TimeUnit.SECONDS)
|
|
|
|
|
.withMaxRetries(MAX_GW_RETRIES);
|
|
|
|
|
|
|
|
|
|