Documentation
¶
Index ¶
- Variables
- func BalanceWarningFields() []*discordgo.MessageEmbedField
- func CheckAccount(ssoCookie string, userID string, captchaAPIKey string) (models.Status, error)
- func CheckAccountAge(ssoCookie string) (int, int, int, int64, error)
- func CheckAccountWithRetry(ssoCookie, userID, captchaProvider string) (models.Status, error)
- func CheckAccounts(s *discordgo.Session)
- func CheckAndNotifyBalance(s *discordgo.Session, userID string, balance float64)
- func CheckRateLimitWithBackoff(userID string, endpoint string) error
- func CheckSSOCookieExpiration(expirationTimestamp int64) (time.Duration, error)
- func CheckVIPStatus(ssoCookie string) (bool, error)
- func CleanupInactiveUsers()
- func CleanupOldAnalyticsData(retentionDays int) error
- func CleanupOldRateLimitData()
- func CleanupOldShadowbanPeriods(retentionDays int) error
- func CleanupOldShardInfo()
- func CleanupUsersByShardAssignment()
- func CreateAccountListEmbed(accounts []models.Account, userID string, page int, totalPages int) *discordgo.MessageEmbed
- func CreateAnnouncementEmbed() *discordgo.MessageEmbed
- func CreateCheckResultEmbed(account models.Account, status models.Status, userSettings models.UserSettings) *discordgo.MessageEmbed
- func CreateComponentsBasedOnConfig(components []discordgo.MessageComponent) []discordgo.MessageComponent
- func CreateErrorEmbed(title string, errorMessage string) *discordgo.MessageEmbed
- func CreateInfoEmbed(title string, message string) *discordgo.MessageEmbed
- func CreateLegacyButton(label, customID string, style discordgo.ButtonStyle) discordgo.MessageComponent
- func CreateShadowbanPeriodsTable() error
- func CreateSuccessEmbed(title string, message string) *discordgo.MessageEmbed
- func CreateV2Button(label, customID string, style discordgo.ButtonStyle) discordgo.MessageComponent
- func DecodeSSOCookie(encodedStr string) (int64, error)
- func DeferWithPreference(s *discordgo.Session, i *discordgo.InteractionCreate, forceEphemeral bool) error
- func DisableUserCaptcha(s *discordgo.Session, userID string, reason string) error
- func DoRequest(req *http.Request) (*http.Response, error)
- func EmbedTitleFromStatus(status models.Status) string
- func FilterAccountsByShardAssignment(accounts []models.Account) []models.Account
- func FilterUserSettingsByShardAssignment(settings []models.UserSettings) []models.UserSettings
- func FixShardAssignments() error
- func FollowupWithPreference(s *discordgo.Session, i *discordgo.InteractionCreate, content string, ...) (*discordgo.Message, error)
- func FormatDuration(d time.Duration) string
- func FormatExpirationTime(expirationTimestamp int64) string
- func GenerateHeaders(ssoCookie string) map[string]string
- func GetAnalyticsStats(days int) (map[string]interface{}, error)
- func GetCheckStatus(isCheckDisabled bool) string
- func GetColorForStatus(status models.Status, isExpiredCookie bool, isCheckDisabled bool) int
- func GetCooldownDuration(userSettings models.UserSettings, notificationType string, ...) time.Duration
- func GetDailyStats(date string) (map[string]interface{}, error)
- func GetDefaultCaptchaAPIKey(provider string) (string, error)
- func GetDefaultHTTPClient() *http.Client
- func GetDefaultSettings() (models.UserSettings, error)
- func GetFallbackProvider(primaryProvider string) string
- func GetGatewayBotInfo(token string) (*discordgo.GatewayBotResponse, error)
- func GetGlobalShadowbanStats(days int) (map[string]interface{}, error)
- func GetHTTPClient() *http.Client
- func GetInstallationStats() (serverCount int64, directCount int64, err error)
- func GetInteractionFlags(i *discordgo.InteractionCreate, forceEphemeral bool) discordgo.MessageFlags
- func GetLongTimeoutHTTPClient() *http.Client
- func GetNotificationChannel(s *discordgo.Session, account models.Account, userSettings models.UserSettings) (string, error)
- func GetRateLimitStatus(userID string, action string) (remaining time.Duration, isLimited bool)
- func GetResponseChannel(s *discordgo.Session, userID string, i *discordgo.InteractionCreate) (string, error)
- func GetShadowbanStatistics(userID string, accountID *uint, days int) (map[string]interface{}, error)
- func GetShardAnalytics(days int) (map[string]interface{}, error)
- func GetShardDistributionStats() (map[string]interface{}, error)
- func GetSharedClient() *http.Client
- func GetStatusDescription(status models.Status, accountTitle string, ban models.Ban) string
- func GetStatusIcon(status models.Status) string
- func GetUserCaptchaKey(userID string) (string, float64, error)
- func GetUserEphemeralPreference(userID string) bool
- func GetUserID(i *discordgo.InteractionCreate) (string, error)
- func GetUserRateLimitStatus(userID string) (bool, time.Duration, int)
- func GetUserSettings(userID string) (models.UserSettings, error)
- func HandleAccountError(s *discordgo.Session, account models.Account, errorType string, err error)
- func HandleDatabaseConnectionLoss()
- func HandleDiscordAPIError(err error, operation string)
- func HandleDuplicateInteraction(s *discordgo.Session, i *discordgo.InteractionCreate) bool
- func HandleGracefulShutdown(s *discordgo.Session)
- func HandleShardFailover(s *discordgo.Session)
- func HandleStatusChange(s *discordgo.Session, account models.Account, newStatus models.Status, ...)
- func HandleSuccessfulCheck(account models.Account)
- func HandleUserRateLimit(s *discordgo.Session, i *discordgo.InteractionCreate) bool
- func InitDefaultSettings()
- func InitHTTPClients()
- func InitializeProxyStatsAfterDB()
- func InitializeServices()
- func IsServiceEnabled(provider string) bool
- func IsUserRateLimited(userID string) bool
- func LoadProxyConfiguration(pm *ProxyManager)
- func LogAccountCheck(accountID uint, userID string, success bool, status models.Status, ...)
- func LogAccountStatusCheck(accountID uint, userID string, status models.Status, ...)
- func LogAnalyticsEvent(eventType, userID, guildID, commandName, status string, shardID int, ...)
- func LogCommandExecution(commandName, userID, guildID string, success bool, responseTimeMs int64, ...)
- func LogInstallationStats(s interface{})
- func LogNotification(userID string, accountID uint, notificationType string, success bool)
- func LogShardEvent(eventType string, metadata map[string]interface{})
- func LogStatusChange(accountID uint, userID string, newStatus, previousStatus models.Status)
- func NewHeaderTransport(base http.RoundTripper, userAgents []string) http.RoundTripper
- func NotifyAdmin(s *discordgo.Session, message string)
- func NotifyAdminWithCooldown(s *discordgo.Session, message string, cooldownDuration time.Duration)
- func NotifyCookieExpiringSoon(s *discordgo.Session, accounts []models.Account) error
- func NotifyNewInstallation(s *discordgo.Session, context string)
- func NotifyUserAboutDisabledAccount(s *discordgo.Session, account models.Account, reason string)
- func PerformShardHealthCheck()
- func QueueNotification(userID string, content string)
- func RecoverFromPanic(operation string)
- func RemoveCaptchaKey(userID string) error
- func ReportCapsolverTaskResult(token string, isValid bool, errorMessage string)
- func ResetRateLimitBackoff(userID string, endpoint string) error
- func RespondWithPreference(s *discordgo.Session, i *discordgo.InteractionCreate, content string, ...) error
- func RespondWithPreferenceAndComponents(s *discordgo.Session, i *discordgo.InteractionCreate, content string, ...) error
- func SafeInteractionRespond(s *discordgo.Session, i *discordgo.InteractionCreate, ...) error
- func ScheduleBalanceChecks(s *discordgo.Session)
- func ScheduleTempBanNotification(s *discordgo.Session, account models.Account, duration string)
- func SendAnnouncementToAllUsers(s *discordgo.Session) error
- func SendConsolidatedDailyUpdate(s *discordgo.Session, userID string, userSettings models.UserSettings, ...)
- func SendEmbedToUser(s *discordgo.Session, userID string, i *discordgo.InteractionCreate, ...) error
- func SendGlobalAnnouncement(s *discordgo.Session, userID string) error
- func SendMessageToUser(s *discordgo.Session, userID string, i *discordgo.InteractionCreate, ...) error
- func SendNotification(s *discordgo.Session, account models.Account, embed *discordgo.MessageEmbed, ...) error
- func SendNotificationWithComponentsV2(s *discordgo.Session, account models.Account, embed *discordgo.MessageEmbed, ...) error
- func ShouldUseComponentsV2() bool
- func SolveCaptchaWithFallback(userID, siteKey, pageURL string) (string, string, error)
- func StartAdminAPI()
- func StartEdgeCaseCleanupRoutine(ctx context.Context)
- func StartErrorCleanupRoutine(ctx context.Context)
- func StartNotificationProcessor(discord *discordgo.Session)
- func StoreCapsolverTaskInfo(taskID, token string)
- func TrackMessageFailure(userID string, errorMessage string)
- func TrackShadowbanTransition(accountID uint, userID string, previousStatus, newStatus models.Status, ...) error
- func TrackUserInteraction(s *discordgo.Session, i *discordgo.InteractionCreate) error
- func UpdateCaptchaUsage(userID string) error
- func UpdateMessageWithPreference(s *discordgo.Session, i *discordgo.InteractionCreate, content string, ...) error
- func UpdateRateLimitBackoff(userID string, endpoint string) error
- func ValidateAccountLimits(userID string) error
- func ValidateAndSanitizeInput(input string, maxLength int) string
- func ValidateCaptchaKey(apiKey, provider string) (bool, float64, error)
- func ValidateComponentsForDiscord(components []discordgo.MessageComponent) []discordgo.MessageComponent
- func ValidateDefaultCapsolverConfig() error
- func ValidateEmbedLimits(embed *discordgo.MessageEmbed) *discordgo.MessageEmbed
- func ValidateInteractionContext(i *discordgo.InteractionCreate) error
- func ValidateMessageLimits(content string) string
- func ValidateRuntimeHealth() error
- func ValidateUserShardAssignments() (map[string]interface{}, error)
- func VerifyEZCaptchaConfig() bool
- func VerifySSOCookie(ssoCookie string) bool
- type AccountValidationResult
- type AdaptiveRateLimits
- type AppShardManager
- func (asm *AppShardManager) EnsureInitialized()
- func (asm *AppShardManager) FallbackToSingleShard()
- func (asm *AppShardManager) FilterUsersByShardAssignment(userIDs []string) []string
- func (asm *AppShardManager) GetAssignedUserIDs(userIDs []string) []string
- func (asm *AppShardManager) GetGuildShardID(guildID string) int
- func (asm *AppShardManager) GetShardedUserCount() (int64, error)
- func (asm *AppShardManager) GetShardingStatus() map[string]interface{}
- func (asm *AppShardManager) GetUserShardID(userID string) int
- func (asm *AppShardManager) GuildBelongsToInstance(guildID string) bool
- func (asm *AppShardManager) Initialize() error
- func (asm *AppShardManager) IsLeader() bool
- func (asm *AppShardManager) IsUserAssignedToShard(userID string) bool
- func (asm *AppShardManager) SafeShardOperation(userID string, operation func() error) error
- func (asm *AppShardManager) ShardBelongsToInstance(userID string) bool
- func (asm *AppShardManager) StartHeartbeat(ctx context.Context)
- type BanResponse
- type CapsolverSolver
- type CaptchaSolver
- type EZCaptchaSolver
- type EdgeCaseHandler
- func (ech *EdgeCaseHandler) Cleanup()
- func (ech *EdgeCaseHandler) EndInteraction(userID string)
- func (ech *EdgeCaseHandler) IsRateLimited(userID string) bool
- func (ech *EdgeCaseHandler) RecordTemporaryFailure(identifier string) bool
- func (ech *EdgeCaseHandler) ResetTemporaryFailures(identifier string)
- func (ech *EdgeCaseHandler) SetRateLimit(userID string, duration time.Duration)
- func (ech *EdgeCaseHandler) StartInteraction(userID string) bool
- type ErrorHandler
- func (eh *ErrorHandler) GetErrorStats(userID string) *ErrorStats
- func (eh *ErrorHandler) MarkNotified(userID string)
- func (eh *ErrorHandler) RecordError(userID string, errorType string, err error)
- func (eh *ErrorHandler) ResetConsecutiveErrors(userID string)
- func (eh *ErrorHandler) ShouldNotifyUser(userID string, errorType string) bool
- type ErrorStats
- type InstallContext
- type NotificationConfig
- type NotificationItem
- type NotificationLimiter
- type NotificationQueue
- type NotificationState
- type ProxyManager
- func (pm *ProxyManager) GetClient() *http.Client
- func (pm *ProxyManager) MarkProxyFailure(proxyURL string, reason string)
- func (pm *ProxyManager) MarkProxyRateLimited(proxyURL string, duration time.Duration)
- func (pm *ProxyManager) MarkProxySuccess(proxyURL string)
- func (pm *ProxyManager) RefreshProxies()
- type ShadowbanPeriod
- type ShardHealthReport
- type ShardManager
- type TwoCaptchaSolver
- type UserBackoff
Constants ¶
This section is empty.
Variables ¶
View Source
var (
DBMutex sync.Mutex
)
Functions ¶
func BalanceWarningFields ¶
func BalanceWarningFields() []*discordgo.MessageEmbedField
func CheckAccount ¶
func CheckAccountWithRetry ¶ added in v1.2.5
func CheckAccounts ¶
func CheckAndNotifyBalance ¶
func CheckRateLimitWithBackoff ¶ added in v1.1.1
func CheckVIPStatus ¶
func CleanupInactiveUsers ¶
func CleanupInactiveUsers()
func CleanupOldAnalyticsData ¶
func CleanupOldRateLimitData ¶
func CleanupOldRateLimitData()
func CleanupOldShadowbanPeriods ¶ added in v1.2.5
func CleanupOldShardInfo ¶ added in v1.2.5
func CleanupOldShardInfo()
func CleanupUsersByShardAssignment ¶ added in v1.2.5
func CleanupUsersByShardAssignment()
func CreateAccountListEmbed ¶ added in v1.1.1
func CreateAnnouncementEmbed ¶
func CreateAnnouncementEmbed() *discordgo.MessageEmbed
func CreateCheckResultEmbed ¶ added in v1.1.1
func CreateCheckResultEmbed(account models.Account, status models.Status, userSettings models.UserSettings) *discordgo.MessageEmbed
func CreateComponentsBasedOnConfig ¶ added in v1.2.0
func CreateComponentsBasedOnConfig(components []discordgo.MessageComponent) []discordgo.MessageComponent
func CreateErrorEmbed ¶ added in v1.1.1
func CreateErrorEmbed(title string, errorMessage string) *discordgo.MessageEmbed
func CreateInfoEmbed ¶ added in v1.1.1
func CreateInfoEmbed(title string, message string) *discordgo.MessageEmbed
func CreateLegacyButton ¶ added in v1.2.0
func CreateLegacyButton(label, customID string, style discordgo.ButtonStyle) discordgo.MessageComponent
func CreateShadowbanPeriodsTable ¶ added in v1.2.5
func CreateShadowbanPeriodsTable() error
func CreateSuccessEmbed ¶ added in v1.1.1
func CreateSuccessEmbed(title string, message string) *discordgo.MessageEmbed
func CreateV2Button ¶ added in v1.2.0
func CreateV2Button(label, customID string, style discordgo.ButtonStyle) discordgo.MessageComponent
func DecodeSSOCookie ¶
func FormatDuration(duration time.Duration) string {
if duration <= 0 {
return "Expired"
}
if duration < 2*time.Hour {
minutes := int(duration.Minutes())
if minutes <= 0 {
return "Less than 1 minute"
}
return fmt.Sprintf("%d minutes", minutes)
}
days := int(duration.Hours() / 24)
hours := int(duration.Hours()) % 24
if days > 0 {
return fmt.Sprintf("%d days, %d hours", days, hours)
} else {
return fmt.Sprintf("%d hours", hours)
}
}
func DeferWithPreference ¶ added in v1.2.0
func DisableUserCaptcha ¶
func EmbedTitleFromStatus ¶
func FilterAccountsByShardAssignment ¶ added in v1.1.1
func FilterUserSettingsByShardAssignment ¶ added in v1.1.1
func FilterUserSettingsByShardAssignment(settings []models.UserSettings) []models.UserSettings
func FixShardAssignments ¶ added in v1.2.5
func FixShardAssignments() error
func FollowupWithPreference ¶ added in v1.2.0
func FollowupWithPreference(s *discordgo.Session, i *discordgo.InteractionCreate, content string, embeds []*discordgo.MessageEmbed, components []discordgo.MessageComponent, forceEphemeral bool) (*discordgo.Message, error)
func FormatDuration ¶
func FormatExpirationTime ¶
func GenerateHeaders ¶
func GetAnalyticsStats ¶ added in v1.2.5
func GetCheckStatus ¶
func GetColorForStatus ¶
func GetCooldownDuration ¶
func GetDailyStats ¶
func GetDefaultCaptchaAPIKey ¶ added in v1.2.0
func GetDefaultHTTPClient ¶
func GetDefaultSettings ¶
func GetDefaultSettings() (models.UserSettings, error)
func GetFallbackProvider ¶ added in v1.2.0
func GetGatewayBotInfo ¶ added in v1.0.1
func GetGatewayBotInfo(token string) (*discordgo.GatewayBotResponse, error)
func GetGlobalShadowbanStats ¶ added in v1.2.5
func GetHTTPClient ¶ added in v1.2.0
func GetInstallationStats ¶
func GetInteractionFlags ¶ added in v1.1.1
func GetInteractionFlags(i *discordgo.InteractionCreate, forceEphemeral bool) discordgo.MessageFlags
func GetNotificationChannel ¶
func GetRateLimitStatus ¶ added in v1.1.1
func GetResponseChannel ¶
func GetShadowbanStatistics ¶ added in v1.2.5
func GetShardAnalytics ¶ added in v1.2.5
func GetShardDistributionStats ¶ added in v1.2.5
func GetSharedClient ¶ added in v1.1.1
func GetStatusDescription ¶
func GetStatusIcon ¶
func GetUserEphemeralPreference ¶ added in v1.1.1
func GetUserSettings ¶
func GetUserSettings(userID string) (models.UserSettings, error)
func HandleAccountError ¶ added in v1.2.0
func HandleDatabaseConnectionLoss ¶ added in v1.2.0
func HandleDatabaseConnectionLoss()
func HandleDiscordAPIError ¶ added in v1.2.0
func HandleDuplicateInteraction ¶ added in v1.2.0
func HandleDuplicateInteraction(s *discordgo.Session, i *discordgo.InteractionCreate) bool
func HandleGracefulShutdown ¶ added in v1.2.0
func HandleShardFailover ¶ added in v1.2.0
func HandleStatusChange ¶
func HandleSuccessfulCheck ¶ added in v1.2.0
func HandleUserRateLimit ¶ added in v1.2.0
func HandleUserRateLimit(s *discordgo.Session, i *discordgo.InteractionCreate) bool
func InitDefaultSettings ¶ added in v1.2.0
func InitDefaultSettings()
func InitHTTPClients ¶
func InitHTTPClients()
func InitializeProxyStatsAfterDB ¶ added in v1.2.0
func InitializeProxyStatsAfterDB()
func InitializeServices ¶
func InitializeServices()
func IsServiceEnabled ¶
func IsUserRateLimited ¶
func CleanupOldRateLimitData() {
adaptiveRateLimits.Lock()
defer adaptiveRateLimits.Unlock()
now := time.Now()
initialCount := len(adaptiveRateLimits.UserBackoffs)
cleaned := 0
for userID, backoff := range adaptiveRateLimits.UserBackoffs {
var recentHistory []time.Time
for _, t := range backoff.NotificationHistory {
if now.Sub(t) <= adaptiveRateLimits.HistoryWindow {
recentHistory = append(recentHistory, t)
}
}
if len(recentHistory) == 0 {
backoff.BackoffMultiplier = 1.0
backoff.ConsecutiveCount = 0
cleaned++
}
backoff.NotificationHistory = recentHistory
if len(recentHistory) == 0 && now.Sub(backoff.LastSent) > adaptiveRateLimits.HistoryWindow {
delete(adaptiveRateLimits.UserBackoffs, userID)
cleaned++
}
}
logger.Log.Infof("Rate limit cleanup completed: processed %d entries, cleaned %d", initialCount, cleaned)
}
func LoadProxyConfiguration ¶ added in v1.1.1
func LoadProxyConfiguration(pm *ProxyManager)
func LogAccountCheck ¶
func LogAccountStatusCheck ¶ added in v1.2.0
func LogAnalyticsEvent ¶ added in v1.2.5
func LogCommandExecution ¶
func LogInstallationStats ¶
func LogInstallationStats(s interface{})
func LogNotification ¶
func LogShardEvent ¶ added in v1.2.5
func LogStatusChange ¶
func NewHeaderTransport ¶ added in v1.1.1
func NewHeaderTransport(base http.RoundTripper, userAgents []string) http.RoundTripper
func NotifyAdmin ¶
func NotifyAdminWithCooldown ¶
func NotifyNewInstallation ¶
func PerformShardHealthCheck ¶ added in v1.2.5
func PerformShardHealthCheck()
func QueueNotification ¶
func RecoverFromPanic ¶ added in v1.2.0
func RecoverFromPanic(operation string)
func RemoveCaptchaKey ¶
func ResetRateLimitBackoff ¶ added in v1.1.1
func RespondWithPreference ¶ added in v1.1.1
func RespondWithPreference(s *discordgo.Session, i *discordgo.InteractionCreate, content string, embeds []*discordgo.MessageEmbed, forceEphemeral bool) error
func RespondWithPreferenceAndComponents ¶ added in v1.2.0
func RespondWithPreferenceAndComponents(s *discordgo.Session, i *discordgo.InteractionCreate, content string, embeds []*discordgo.MessageEmbed, components []discordgo.MessageComponent, forceEphemeral bool) error
func SafeInteractionRespond ¶ added in v1.2.0
func SafeInteractionRespond(s *discordgo.Session, i *discordgo.InteractionCreate, response *discordgo.InteractionResponse) error
func ScheduleBalanceChecks ¶
func SendEmbedToUser ¶
func SendEmbedToUser(s *discordgo.Session, userID string, i *discordgo.InteractionCreate, embed *discordgo.MessageEmbed) error
func SendGlobalAnnouncement ¶
func SendMessageToUser ¶
func SendNotification ¶
func SendNotificationWithComponentsV2 ¶ added in v1.2.0
func SendNotificationWithComponentsV2(s *discordgo.Session, account models.Account, embed *discordgo.MessageEmbed, content, notificationType string, components []discordgo.MessageComponent) error
func ShouldUseComponentsV2 ¶ added in v1.2.0
func ShouldUseComponentsV2() bool
func SolveCaptchaWithFallback ¶ added in v1.2.0
func StartAdminAPI ¶
func StartAdminAPI()
func StartEdgeCaseCleanupRoutine ¶ added in v1.2.0
func StartErrorCleanupRoutine ¶ added in v1.2.0
func StoreCapsolverTaskInfo ¶
func StoreCapsolverTaskInfo(taskID, token string)
func TrackMessageFailure ¶
func TrackShadowbanTransition ¶ added in v1.2.5
func TrackUserInteraction ¶
func TrackUserInteraction(s *discordgo.Session, i *discordgo.InteractionCreate) error
func UpdateCaptchaUsage ¶
func UpdateMessageWithPreference ¶ added in v1.1.1
func UpdateMessageWithPreference(s *discordgo.Session, i *discordgo.InteractionCreate, content string, embeds []*discordgo.MessageEmbed, components []discordgo.MessageComponent) error
func UpdateRateLimitBackoff ¶ added in v1.1.1
func ValidateAccountLimits ¶ added in v1.2.0
func ValidateAndSanitizeInput ¶ added in v1.2.0
func ValidateComponentsForDiscord ¶ added in v1.2.0
func ValidateComponentsForDiscord(components []discordgo.MessageComponent) []discordgo.MessageComponent
func ValidateDefaultCapsolverConfig ¶
func ValidateDefaultCapsolverConfig() error
func ValidateEmbedLimits ¶ added in v1.2.0
func ValidateEmbedLimits(embed *discordgo.MessageEmbed) *discordgo.MessageEmbed
func ValidateInteractionContext ¶ added in v1.2.0
func ValidateInteractionContext(i *discordgo.InteractionCreate) error
func ValidateMessageLimits ¶ added in v1.2.0
func ValidateRuntimeHealth ¶ added in v1.2.0
func ValidateRuntimeHealth() error
func ValidateUserShardAssignments ¶ added in v1.2.5
func VerifyEZCaptchaConfig ¶
func VerifyEZCaptchaConfig() bool
func VerifySSOCookie ¶
Types ¶
type AccountValidationResult ¶
type AccountValidationResult struct {
IsValid bool
Created int64
IsVIP bool
ExpiresAt int64
ProfileData map[string]interface{}
}
func ValidateAndGetAccountInfo ¶
func ValidateAndGetAccountInfo(ssoCookie string) (*AccountValidationResult, error)
type AdaptiveRateLimits ¶
type AdaptiveRateLimits struct {
sync.RWMutex
UserBackoffs map[string]*UserBackoff
BaseLimit int
HistoryWindow time.Duration
}
func (*AdaptiveRateLimits) GetBackoffDuration ¶
func (a *AdaptiveRateLimits) GetBackoffDuration(userID string) time.Duration
type AppShardManager ¶ added in v1.1.1
type AppShardManager struct {
sync.RWMutex
ShardID int
TotalShards int
InstanceID string
HeartbeatTime time.Time
Initialized bool
// contains filtered or unexported fields
}
func GetAppShardManager ¶ added in v1.1.1
func GetAppShardManager() *AppShardManager
func (*AppShardManager) EnsureInitialized ¶ added in v1.2.5
func (asm *AppShardManager) EnsureInitialized()
func (*AppShardManager) FallbackToSingleShard ¶ added in v1.2.5
func (asm *AppShardManager) FallbackToSingleShard()
func (*AppShardManager) FilterUsersByShardAssignment ¶ added in v1.1.1
func (asm *AppShardManager) FilterUsersByShardAssignment(userIDs []string) []string
func (*AppShardManager) GetAssignedUserIDs ¶ added in v1.2.5
func (asm *AppShardManager) GetAssignedUserIDs(userIDs []string) []string
func (*AppShardManager) GetGuildShardID ¶ added in v1.1.1
func (asm *AppShardManager) GetGuildShardID(guildID string) int
func (*AppShardManager) GetShardedUserCount ¶ added in v1.1.1
func (asm *AppShardManager) GetShardedUserCount() (int64, error)
func (*AppShardManager) GetShardingStatus ¶ added in v1.1.1
func (asm *AppShardManager) GetShardingStatus() map[string]interface{}
func (*AppShardManager) GetUserShardID ¶ added in v1.1.1
func (asm *AppShardManager) GetUserShardID(userID string) int
func (*AppShardManager) GuildBelongsToInstance ¶ added in v1.1.1
func (asm *AppShardManager) GuildBelongsToInstance(guildID string) bool
func (*AppShardManager) Initialize ¶ added in v1.1.1
func (asm *AppShardManager) Initialize() error
func (*AppShardManager) IsLeader ¶ added in v1.2.5
func (asm *AppShardManager) IsLeader() bool
func (*AppShardManager) IsUserAssignedToShard ¶ added in v1.1.1
func (asm *AppShardManager) IsUserAssignedToShard(userID string) bool
func (*AppShardManager) SafeShardOperation ¶ added in v1.2.5
func (asm *AppShardManager) SafeShardOperation(userID string, operation func() error) error
func (*AppShardManager) ShardBelongsToInstance ¶ added in v1.1.1
func (asm *AppShardManager) ShardBelongsToInstance(userID string) bool
func (*AppShardManager) StartHeartbeat ¶ added in v1.1.1
func (asm *AppShardManager) StartHeartbeat(ctx context.Context)
type BanResponse ¶ added in v1.1.1
type CapsolverSolver ¶
func (*CapsolverSolver) SolveReCaptchaV2 ¶
func (s *CapsolverSolver) SolveReCaptchaV2(siteKey, pageURL string) (string, error)
type CaptchaSolver ¶
func GetCaptchaSolver ¶
func GetCaptchaSolver(userID string) (CaptchaSolver, error)
func NewCaptchaSolver ¶
func NewCaptchaSolver(apiKey, provider string) (CaptchaSolver, error)
type EZCaptchaSolver ¶
func (*EZCaptchaSolver) SolveReCaptchaV2 ¶
func (s *EZCaptchaSolver) SolveReCaptchaV2(siteKey, pageURL string) (string, error)
type EdgeCaseHandler ¶ added in v1.2.0
type EdgeCaseHandler struct {
// contains filtered or unexported fields
}
func GetEdgeCaseHandler ¶ added in v1.2.0
func GetEdgeCaseHandler() *EdgeCaseHandler
func (*EdgeCaseHandler) Cleanup ¶ added in v1.2.0
func (ech *EdgeCaseHandler) Cleanup()
func (*EdgeCaseHandler) EndInteraction ¶ added in v1.2.0
func (ech *EdgeCaseHandler) EndInteraction(userID string)
func (*EdgeCaseHandler) IsRateLimited ¶ added in v1.2.0
func (ech *EdgeCaseHandler) IsRateLimited(userID string) bool
func (*EdgeCaseHandler) RecordTemporaryFailure ¶ added in v1.2.0
func (ech *EdgeCaseHandler) RecordTemporaryFailure(identifier string) bool
func (*EdgeCaseHandler) ResetTemporaryFailures ¶ added in v1.2.0
func (ech *EdgeCaseHandler) ResetTemporaryFailures(identifier string)
func (*EdgeCaseHandler) SetRateLimit ¶ added in v1.2.0
func (ech *EdgeCaseHandler) SetRateLimit(userID string, duration time.Duration)
func (*EdgeCaseHandler) StartInteraction ¶ added in v1.2.0
func (ech *EdgeCaseHandler) StartInteraction(userID string) bool
type ErrorHandler ¶ added in v1.2.0
type ErrorHandler struct {
// contains filtered or unexported fields
}
func GetErrorHandler ¶ added in v1.2.0
func GetErrorHandler() *ErrorHandler
func (*ErrorHandler) GetErrorStats ¶ added in v1.2.0
func (eh *ErrorHandler) GetErrorStats(userID string) *ErrorStats
func (*ErrorHandler) MarkNotified ¶ added in v1.2.0
func (eh *ErrorHandler) MarkNotified(userID string)
func (*ErrorHandler) RecordError ¶ added in v1.2.0
func (eh *ErrorHandler) RecordError(userID string, errorType string, err error)
func (*ErrorHandler) ResetConsecutiveErrors ¶ added in v1.2.0
func (eh *ErrorHandler) ResetConsecutiveErrors(userID string)
func (*ErrorHandler) ShouldNotifyUser ¶ added in v1.2.0
func (eh *ErrorHandler) ShouldNotifyUser(userID string, errorType string) bool
type ErrorStats ¶ added in v1.2.0
type InstallContext ¶
type InstallContext string
const ( ServerContext InstallContext = "server" DirectContext InstallContext = "direct" )
func GetInstallContext ¶
func GetInstallContext(i *discordgo.InteractionCreate) InstallContext
type NotificationConfig ¶
type NotificationItem ¶
type NotificationLimiter ¶
func NewNotificationLimiter ¶
func NewNotificationLimiter() *NotificationLimiter
func (*NotificationLimiter) CanSendNotification ¶
func (nl *NotificationLimiter) CanSendNotification(userID string, notificationType string) bool
type NotificationQueue ¶
type NotificationQueue struct {
// contains filtered or unexported fields
}
func (*NotificationQueue) AddNotification ¶
func (q *NotificationQueue) AddNotification(item NotificationItem)
type NotificationState ¶
type NotificationState struct {
// contains filtered or unexported fields
}
type ProxyManager ¶ added in v1.1.1
type ProxyManager struct {
sync.RWMutex
Proxies []string
ActiveProxies map[string]bool
ProxyFailures map[string]int
ProxyLastUsed map[string]time.Time
ProxyRateLimits map[string]time.Time
DefaultClient *http.Client
ProxyClients map[string]*http.Client
ProxyEnabled bool
RotationStrategy string
CurrentProxyIndex int
MaxFailures int
CooldownPeriod time.Duration
ProxyRefreshPeriod time.Duration
LastRefresh time.Time
UserAgents []string
}
func GetProxyManager ¶ added in v1.1.1
func GetProxyManager() *ProxyManager
func (*ProxyManager) GetClient ¶ added in v1.1.1
func (pm *ProxyManager) GetClient() *http.Client
func (*ProxyManager) MarkProxyFailure ¶ added in v1.1.1
func (pm *ProxyManager) MarkProxyFailure(proxyURL string, reason string)
func (*ProxyManager) MarkProxyRateLimited ¶ added in v1.1.1
func (pm *ProxyManager) MarkProxyRateLimited(proxyURL string, duration time.Duration)
func (*ProxyManager) MarkProxySuccess ¶ added in v1.1.1
func (pm *ProxyManager) MarkProxySuccess(proxyURL string)
func (*ProxyManager) RefreshProxies ¶ added in v1.1.1
func (pm *ProxyManager) RefreshProxies()
type ShadowbanPeriod ¶ added in v1.2.5
type ShadowbanPeriod struct {
AccountID uint `json:"account_id"`
UserID string `json:"user_id"`
AccountTitle string `json:"account_title"`
StartTime time.Time `json:"start_time"`
EndTime *time.Time `json:"end_time,omitempty"`
DurationHours *float64 `json:"duration_hours,omitempty"`
IsCompleted bool `json:"is_completed"`
StartBanID uint `json:"start_ban_id"`
EndBanID *uint `json:"end_ban_id,omitempty"`
CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"`
}
type ShardHealthReport ¶ added in v1.2.5
type ShardHealthReport struct {
CheckTime time.Time `json:"check_time"`
Healthy bool `json:"healthy"`
Issues []string `json:"issues"`
Warnings []string `json:"warnings"`
CurrentShard int `json:"current_shard"`
TotalShards int `json:"total_shards"`
ActiveShards int `json:"active_shards"`
DeadShards int `json:"dead_shards"`
InstanceID string `json:"instance_id"`
IsLeader bool `json:"is_leader"`
TotalAccounts int `json:"total_accounts"`
ShardAccounts int `json:"shard_accounts"`
UserDistribution map[string]interface{} `json:"user_distribution"`
}
func ShardHealthCheck ¶ added in v1.2.5
func ShardHealthCheck() (*ShardHealthReport, error)
func (*ShardHealthReport) String ¶ added in v1.2.5
func (r *ShardHealthReport) String() string
type ShardManager ¶ added in v1.0.1
type ShardManager struct {
sync.Mutex
Sessions []*discordgo.Session
MaxConcurrency int
TotalShards int
StartedShards int
}
func NewShardManager ¶ added in v1.0.1
func NewShardManager() (*ShardManager, error)
func (*ShardManager) Close ¶ added in v1.0.1
func (sm *ShardManager) Close()
func (*ShardManager) GetSession ¶ added in v1.0.1
func (sm *ShardManager) GetSession(guildID string) *discordgo.Session
func (*ShardManager) StartShards ¶ added in v1.0.1
func (sm *ShardManager) StartShards(token string, handlers map[string]func(*discordgo.Session, *discordgo.InteractionCreate)) error
type TwoCaptchaSolver ¶
func (*TwoCaptchaSolver) SolveReCaptchaV2 ¶
func (s *TwoCaptchaSolver) SolveReCaptchaV2(siteKey, pageURL string) (string, error)
Source Files
¶
- account_manager.go
- admin_api.go
- analytics.go
- app_sharding.go
- captcha_solver.go
- cleanup_users.go
- context-tracking.go
- context.go
- edge_case_handling.go
- embeds_gen.go
- ephemeral_helper.go
- error_handling.go
- header.go
- http.go
- http_client.go
- mainfunction.go
- notifications.go
- notifications_queue.go
- proxy_manager.go
- rate_limit.go
- shadowban_analytics.go
- shard_health.go
- shard_manager.go
- ssocookie.go
- user_settings.go
Click to show internal directories.
Click to hide internal directories.