KittehOrg / KittehIRCClientLib

An IRC client library in Java
https://kitteh.dev/kicl/
MIT License
146 stars 34 forks source link

Support a message burst for delays. #147

Closed Zarthus closed 7 years ago

Zarthus commented 8 years ago

KICL currently supports a messageDelay, which is a flat delay between each message sent.

Ideally, it also supports a burst limit (that resets after either 10 seconds, or burstDelay) before the regular delay kicks in.

I think this also would deserve it's own page of documentation in docs if it were implemented.

mbax commented 8 years ago

This is something I'd like to see. Perhaps some sort of functional interface that returns how many millis before the next message is sent. That way, could still support someone providing just an integer, as that would then just be a steady message delay and KICL could wrap the int.

@FunctionalInterface
public interface DelayDeterminer {
    /**
     * Gets the delay before the next message is sent
     *
     * @return delay
     */
    int getNextDelay();
}

public ClientBuilder messageDelay(DelayDeterminer determiner) {
    this.config.set(Config.MESSAGE_DELAY, determiner);
    return this;
}

public ClientBuilder messageDelay(int constantDelay) {
    return messageDelay(() -> constantDelay);
}
mbax commented 7 years ago

I've decided to go... a bit further than this.

https://github.com/KittehOrg/KittehIRCClientLib/commit/19a3d709b5eb4510a684eb6926b58edd7bb84b92

Zarthus commented 7 years ago

I dig it. Kittens to all whom were involved in thinking of and implementing this idea!

On 29 Dec 2016 06:20, "Matt Baxter" notifications@github.com wrote:

Closed #147 https://github.com/KittehOrg/KittehIRCClientLib/issues/147.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/KittehOrg/KittehIRCClientLib/issues/147#event-907072503, or mute the thread https://github.com/notifications/unsubscribe-auth/ADfaeIJoUqhHm6BUR2Z-aPxNwVXqvDI0ks5rM0MggaJpZM4KSAZ- .