tokenprovider

package
v8.3.4 Latest Latest
Warning

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

Go to latest
Published: Jan 8, 2024 License: MIT Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const DefaultMaxWorkers = 8

Variables

View Source
var PremiumBotConstraints = map[premium.Tier]int{
	0: 0,
	1: 0,
	2: 1,
	3: 3,
	4: 10,
	5: 100,
}
View Source
var UnresponsiveCaptureBlacklistDuration = time.Minute * time.Duration(5)

Functions

func RecordDiscordRequestsByCounts

func RecordDiscordRequestsByCounts(client *redis.Client, counts task.MuteDeafenSuccessCounts)

Types

type TokenProvider

type TokenProvider struct {
	// contains filtered or unexported fields
}

func NewTokenProvider

func NewTokenProvider(client *redis.Client, sess *discordgo.Session, taskTimeout time.Duration, maxReq int64) *TokenProvider

func (*TokenProvider) BlacklistTokenForDuration

func (tokenProvider *TokenProvider) BlacklistTokenForDuration(guildID, hashToken string, duration time.Duration) error

BlacklistTokenForDuration sets a guild token (or connect code ala capture bot) to the maximum value allowed before attempting other non-rate-limited mute/deafen methods. NOTE: this will manifest as the capture/token in question appearing like it "has been used <maxnum> times" in logs, even if this is not technically accurate. A more accurate approach would probably use a totally separate Redis key, as opposed to this approach, which simply uses the ratelimiting counter key(s) to achieve blacklisting

func (*TokenProvider) Close

func (tokenProvider *TokenProvider) Close()

func (*TokenProvider) IncrAndTestGuildTokenComboLock

func (tokenProvider *TokenProvider) IncrAndTestGuildTokenComboLock(guildID, hashToken string) bool

func (*TokenProvider) Init

func (tp *TokenProvider) Init(client *redis.Client, sess *discordgo.Session)

func (*TokenProvider) ModifyUsers

func (tokenProvider *TokenProvider) ModifyUsers(guildID, connectCode string, request task.UserModifyRequest, voicelock *redislock.Lock) error

func (*TokenProvider) PopulateAndStartSessions

func (tokenProvider *TokenProvider) PopulateAndStartSessions(tokens []string)

Jump to

Keyboard shortcuts

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