diff options
Diffstat (limited to 'src/io/RateLimitException.java')
-rw-r--r-- | src/io/RateLimitException.java | 15 |
1 files changed, 12 insertions, 3 deletions
diff --git a/src/io/RateLimitException.java b/src/io/RateLimitException.java index 2bb2624..e196702 100644 --- a/src/io/RateLimitException.java +++ b/src/io/RateLimitException.java @@ -2,17 +2,26 @@ package io; /** * The exception that will be thrown when a ratelimit has been hit. - * + * * @author Maurice Laveaux */ public class RateLimitException extends Exception { + private final long rateLimitReset; - + public RateLimitException(long resetTime) { rateLimitReset = resetTime; } - + public long getResetTime() { return rateLimitReset; } + + /** + * @return Time in milliseconds that should be waited for before a new + * similar request can be executed. + */ + public long getRateLimitRemainingTime() { + return rateLimitReset * 1000 - System.currentTimeMillis(); + } } |