Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
gorm.Model
UserID string `gorm:"index"` // The ID of the user.
GuildID string `gorm:"default:''"` // The guild ID if the account was added in a server context
ChannelID string // The ID of the channel associated with the account.
Title string // user assigned title for the account
ActivisionID string // The Activision ID associated with this account
LastStatus Status `gorm:"default:unknown"` // The last known status of the account.
LastCheck int64 `gorm:"default:0"` // The timestamp of the last check performed on the account.
LastNotification int64 // The timestamp of the last daily notification sent out on the account.
LastCookieNotification int64 // The timestamp of the last notification sent out on the account for an expired ssocookie.
SSOCookie string // The SSO cookie associated with the account.
Created int64 // The timestamp of when the account was created on Activision.
IsExpiredCookie bool `gorm:"default:false"` // A flag indicating if the SSO cookie has expired.
NotificationType string `gorm:"default:channel"` // User preference for location of notifications either channel or dm
IsPermabanned bool `gorm:"default:false"` // A flag indicating if the account is permanently banned
IsShadowbanned bool `gorm:"default:false"` // A flag indicating if the account is shadowbanned
IsTempbanned bool `gorm:"default:false"` // A flag indicating if the account is temporarily banned
IsVIP bool `gorm:"default:false"` // A flag indicating if the account is a VIP
IsOGVerdansk bool `gorm:"default:false"` // A flag indicating if account has Verdansk stats
LastCookieCheck int64 `gorm:"default:0"` // The timestamp of the last cookie check for permanently banned accounts.
LastStatusChange int64 `gorm:"default:0"` // The timestamp of the last status change
IsCheckDisabled bool `gorm:"default:false"` // A flag indicating if checks are disabled for this account
DisabledReason string // Reason for disabling checks
SSOCookieExpiration int64 // The timestamp of the SSO cookie expiration
ConsecutiveErrors int `gorm:"default:0"` // The number of consecutive errors encountered while checking the account
LastSuccessfulCheck time.Time // The timestamp of the last successful check
LastErrorTime time.Time // The timestamp of the last error encountered
Last24HourNotification time.Time // The timestamp of the last 24-hour notification
LastCheckNowTime time.Time // For check now command rate limiting
LastAddAccountTime time.Time // For add account rate limiting
}
type Analytics ¶
type Analytics struct {
gorm.Model
Type string `gorm:"index"` // The type of analytics entry.
UserID string `gorm:"index"` // The ID of the user.
GuildID string `gorm:"index"` // The ID of the guild.
CommandName string `gorm:"index"` // The name of the command.
AccountID uint `gorm:"index"` // The ID of the account.
Status string `gorm:"index"` // The status of the account.
PreviousStatus string `gorm:"index"` // The previous status of the account.
Success bool // Whether the action was successful.
ResponseTimeMs int64 // Response time in milliseconds.
CaptchaProvider string // The name of the captcha provider used.
CaptchaCost float64 // Cost of the captcha
ErrorDetails string // For storing error information when relevant
Timestamp time.Time `gorm:"index"` // When this log entry was created
Day string `gorm:"index"` // YYYY-MM-DD format for easy querying
}
type Ban ¶
type Ban struct {
gorm.Model
Account Account // The account that has a status history.
AccountID uint // The ID of the account.
Status Status // The status of the ban.
LogType string // Type of log entry ("status_change", "account_added", "cookie_update", "check_disabled", "error")
Message string // Detailed message about the log entry
PreviousStatus Status // Store the previous status for better tracking
TempBanDuration string // Duration of the temporary ban (if applicable)
AffectedGames string // Comma-separated list of affected games
Timestamp time.Time `gorm:"default:CURRENT_TIMESTAMP"` // When this log entry was created
Initiator string // "auto_check" or "manual_check" or "system"
ErrorDetails string // For storing error information when relevant
}
type BotStatistics ¶
type CaptchaProvider ¶
type CaptchaProvider string // The type of captcha provider used.
const ( Capsolver CaptchaProvider = "capsolver" // The captcha provider is CapSolver. EZCaptcha CaptchaProvider = "ezcaptcha" // The captcha provider is EZCaptcha. TwoCaptcha CaptchaProvider = "2captcha" // The captcha provider is 2Captcha. )
type CommandStatistics ¶
type Status ¶
type Status string // The status of the account.
const ( StatusGood Status = "Good" // The account status returned as good standing. StatusPermaban Status = "Permaban" // The account status returned as permanent ban. StatusShadowban Status = "Shadowban" // The account status returned as shadowban. StatusUnknown Status = "Unknown" // The account status not known. StatusInvalidCookie Status = "Invalid_Cookie" // The account has an invalid SSO cookie. StatusTempban Status = "Temporary" // The account status returned as temporarily banned. )
type SuppressedNotification ¶
type SuppressedNotification struct {
gorm.Model
UserID string `gorm:"index"` // The ID of the user.
NotificationType string // The type of notification suppressed.
Content string `gorm:"type:text"` // The content of the suppressed notification.
Timestamp time.Time `gorm:"index"` // The timestamp of the suppressed notification.
}
type UserSettings ¶
type UserSettings struct {
gorm.Model
UserID string `gorm:"type:varchar(255);uniqueIndex"` // The ID of the user.
CapSolverAPIKey string // User's own Capsolver API key, if provided
EZCaptchaAPIKey string // User's own EZCaptcha API key, if provided
TwoCaptchaAPIKey string // User's own 2captcha API key, if provided
PreferredCaptchaProvider string `gorm:"default:'capsolver'"` // 'capsolver', 'ezcaptcha' or '2captcha'
CaptchaBalance float64 // Current balance for the selected provider
LastBalanceCheck time.Time // Last time the balance was checked
CheckInterval int // the user's set check interval
NotificationInterval float64 // the user's preferred notification interval
CooldownDuration float64 // the user's cooldown duration for actions
StatusChangeCooldown float64 // the user's cooldown duration for status changes
HasSeenAnnouncement bool `gorm:"default:false"` // Flag to track if the user has seen the global announcement.
NotificationType string `gorm:"default:channel"` // User preference for location of notifications either channel or dm
NotificationTimes map[string]time.Time `gorm:"serializer:json"` // For all notification cooldowns
ActionCounts map[string]int `gorm:"serializer:json"` // For counting actions within time windows
LastActionTimes map[string]time.Time `gorm:"serializer:json"` // For tracking when actions were last performed
LastNotification time.Time // Timestamp of the last notification
LastDisabledNotification time.Time // Timestamp of the last disabled notification
LastStatusChangeNotification time.Time // Timestamp of the last status change notification
LastDailyUpdateNotification time.Time // Timestamp of the last daily update notification
LastCookieExpirationWarning time.Time // Timestamp of the last cookie expiration warning
LastBalanceNotification time.Time // Timestamp of the last balance notification
LastErrorNotification time.Time // Timestamp of the last error notification
CustomSettings bool `gorm:"default:false"` // Flag to indicate if user has custom settings
LastCommandTimes map[string]time.Time `gorm:"serializer:json"` // Map of command names to their last execution time
RateLimitExpiration map[string]time.Time `gorm:"serializer:json"` // Map of command names to their rate limit expiration time
InstallationType string `gorm:"default:''"` // 'server' or 'direct' - how the user installed the bot
InstallationGuildID string `gorm:"default:''"` // The guild ID where the bot was installed (if server)
InstallationTime time.Time // When the user first interacted with the bot
LastGuildInteraction time.Time // Last time the user interacted in a guild context
LastDirectInteraction time.Time // Last time the user interacted in DM context
PrimaryInteractionContext string `gorm:"default:''"` // The context where the user interacts most frequently
MessageFailures int `gorm:"default:0"` // Number of failed messages
LastMessageFailure time.Time // Timestamp of the last failed message
IsUnreachable bool `gorm:"default:false"` // Flag to indicate if the account is unreachable
UnreachableSince time.Time // Timestamp when the account became unreachable
}
func (*UserSettings) BeforeCreate ¶
func (u *UserSettings) BeforeCreate(tx *gorm.DB) error
func (*UserSettings) EnsureMapsInitialized ¶
func (u *UserSettings) EnsureMapsInitialized()
func (*UserSettings) UpdateInteractionContext ¶
func (u *UserSettings) UpdateInteractionContext(guildID string)
Click to show internal directories.
Click to hide internal directories.