common

package
v0.0.0-...-b16daea Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 18, 2021 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const GlobalUserRateLimitDuration = 1 * time.Second
View Source
const NewGameRateLimitDuration = 3000 * time.Millisecond
View Source
const ReactionRateLimitDuration = 3000 * time.Millisecond
View Source
const SoftbanDuration = 5 * time.Minute

when a user exceeds the threshold, they're ignored for this long

View Source
const SoftbanExpiration = 10 * time.Minute

how far back the bot should look for violations. Softban is invoked by violations>threshold in this amt of time

View Source
const SoftbanThreshold = 3

how many violations before a softban

Variables

This section is empty.

Functions

func IncrementRateLimitExceed

func IncrementRateLimitExceed(client *redis.Client, userID string) bool

func IsUserBanned

func IsUserBanned(client *redis.Client, userID string) bool

func IsUserRateLimitedGeneral

func IsUserRateLimitedGeneral(client *redis.Client, userID string) bool

func IsUserRateLimitedSpecific

func IsUserRateLimitedSpecific(client *redis.Client, userID string, cmdType string) bool

func MarkUserRateLimit

func MarkUserRateLimit(client *redis.Client, userID, cmdType string, ttl time.Duration)

func UserRateLimitGeneralKey

func UserRateLimitGeneralKey(userID string) string

func UserRateLimitSpecificKey

func UserRateLimitSpecificKey(userID, cmdType string) string

func UserSoftbanCountKey

func UserSoftbanCountKey(userID string) string

func UserSoftbanKey

func UserSoftbanKey(userID string) string

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL