ChatRatelimiter

struct ChatRatelimiter (
int maxMessages
Duration timespan
) {
InterruptibleTaskMutex mutex;
}

Members

Functions

peekBase
bool peekBase()

Returns true if a message can be sent instantly or with the baseDelay.

peekInstant
bool peekInstant()

Returns true if a message can be sent instantly.

Variables

baseDelay
Duration baseDelay;

Delay to always apply to avoid large gaps

cycle
int cycle;

Index where to insert in times array right now.

times
long[maxMessages] times;

Log of all sent message times in ms, because that's what bancho uses.

Meta