Documentation
¶
Overview ¶
* Written in 2019 by Andrew Ayer * * To the extent possible under law, the author(s) have dedicated all * copyright and related and neighboring rights to this software to the * public domain worldwide. This software is distributed without any * warranty. * * You should have received a copy of the CC0 Public * Domain Dedication along with this software. If not, see * <https://creativecommons.org/publicdomain/zero/1.0/>.
Index ¶
- Constants
- Variables
- func Accelerator_CanAssignRole(ctx context.Context, guildID discord.Snowflake, role *discord.Role) (canAssignRoles, isRoleAssignable, isRoleElevated bool, err error)
- func AcquireSession(ctx context.Context, applicationIdentifier string) (*discord.Session, error)
- func AddGuildFeatureWithAudit(ctx context.Context, params database.AddGuildFeatureParams, ...) error
- func AddManagerNameToContext(ctx context.Context, managerName string) context.Context
- func AddMembershipToServer(ctx context.Context, membership database.GetUserMembershipsByUserIDRow, ...) (newMembership database.UpdateUserMembershipParams, err error)
- func AddSessionToContext(ctx context.Context, session *discord.Session) context.Context
- func AssertLength(name string, expectedLength int, arguments ...any) (err error)
- func AssertMaxLength(name string, maximumLength int, arguments ...any) (err error)
- func AssertMinLength(name string, minimumLength int, arguments ...any) (err error)
- func Atoi(s string) (int64, error)
- func AuditChange(ctx context.Context, guildID, userID discord.Snowflake, ...)
- func BytesToJSONB(value []byte) pgtype.JSONB
- func CanAssignRole(role *discord.Role, guildRoles []*discord.Role, ...) (isAssignable, isElevated bool)
- func CheckChannelGuild(ctx context.Context, c sandwich_protobuf.SandwichClient, ...) (bool, error)
- func Coalesce(values ...string) string
- func CompareStrings(query string, targets ...string) bool
- func CompareStructsAsJSON[T comparable](oldStruct, newStruct T) ([]byte, bool, error)
- func ConvertToRGBA(int32Color int64) color.RGBA
- func CreateBorderwallRequestWithAudit(ctx context.Context, params database.CreateBorderwallRequestParams, ...) (*database.BorderwallRequests, error)
- func CreateCustomBotWithAudit(ctx context.Context, params database.CreateCustomBotParams, ...) (*database.CustomBots, error)
- func CreateGuildWithAudit(ctx context.Context, params database.CreateGuildParams, ...) (*database.Guilds, error)
- func CreateMembershipForUser(ctx context.Context, userID discord.Snowflake, transactionUUID uuid.UUID, ...) error
- func CreateOrUpdateAutoRolesGuildSettingsWithAudit(ctx context.Context, ...) (*database.GuildSettingsAutoroles, error)
- func CreateOrUpdateBorderwallGuildSettingsWithAudit(ctx context.Context, ...) (*database.GuildSettingsBorderwall, error)
- func CreateOrUpdateFreeRolesGuildSettingsWithAudit(ctx context.Context, ...) (*database.GuildSettingsFreeroles, error)
- func CreateOrUpdateLeaverGuildSettingsWithAudit(ctx context.Context, params database.CreateOrUpdateLeaverGuildSettingsParams, ...) (*database.GuildSettingsLeaver, error)
- func CreateOrUpdateRulesGuildSettingsWithAudit(ctx context.Context, params database.CreateOrUpdateRulesGuildSettingsParams, ...) (*database.GuildSettingsRules, error)
- func CreateOrUpdateTempChannelsGuildSettingsWithAudit(ctx context.Context, ...) (*database.GuildSettingsTempchannels, error)
- func CreateOrUpdateTimeRolesGuildSettingsWithAudit(ctx context.Context, ...) (*database.GuildSettingsTimeroles, error)
- func CreateOrUpdateUserWithAudit(ctx context.Context, params database.CreateOrUpdateUserParams, ...) (*database.Users, error)
- func CreateOrUpdateWelcomerDMsGuildSettingsWithAudit(ctx context.Context, ...) (*database.GuildSettingsWelcomerDms, error)
- func CreateOrUpdateWelcomerGuildSettingsWithAudit(ctx context.Context, params database.CreateOrUpdateWelcomerGuildSettingsParams, ...) (*database.GuildSettingsWelcomer, error)
- func CreateOrUpdateWelcomerImagesGuildSettingsWithAudit(ctx context.Context, ...) (*database.GuildSettingsWelcomerImages, error)
- func CreateOrUpdateWelcomerTextGuildSettingsWithAudit(ctx context.Context, ...) (*database.GuildSettingsWelcomerText, error)
- func CreateTransactionForUser(ctx context.Context, userID discord.Snowflake, ...) (*database.UserTransactions, error)
- func CreateUserWithAudit(ctx context.Context, params database.CreateUserParams, actor discord.Snowflake) (*database.Users, error)
- func CreateWelcomerImagesWithAudit(ctx context.Context, params database.CreateWelcomerImagesParams, ...) (*database.WelcomerImages, error)
- func DecryptBotToken(encryptedToken string, botID uuid.UUID) (string, error)
- func EncryptBotToken(token string, botID uuid.UUID) (string, error)
- func EnsureGuild(ctx context.Context, guildID discord.Snowflake) error
- func EscapeStringForJSON(value string) string
- func FetchGuild(ctx context.Context, guildID discord.Snowflake) (*discord.Guild, error)
- func FetchGuildChannels(ctx context.Context, guildID discord.Snowflake) ([]*discord.Channel, error)
- func FetchGuildName(ctx context.Context, guildID discord.Snowflake) string
- func FetchUser(ctx context.Context, userID discord.Snowflake) (*discord.User, error)
- func FilterAssignableRoles(ctx context.Context, sandwichClient pb.SandwichClient, ...) (out []discord.Role, err error)
- func FilterAssignableRolesAsSnowflakes(ctx context.Context, sandwichClient pb.SandwichClient, ...) (out []discord.Snowflake, err error)
- func FormatNumber(value int64, locale database.NumberLocale) string
- func FormatString(funcs map[string]govaluate.ExpressionFunction, vars map[string]any, ...) (string, error)
- func FormatTextStroke(v bool) int
- func Ftoa(v float64) string
- func GatherFunctions(numberLocale database.NumberLocale) (funcs map[string]govaluate.ExpressionFunction)
- func GatherVariables(eventCtx *sandwich.EventContext, member *discord.GuildMember, ...) (vars map[string]any)
- func GetConfigurationGatherer(ctx context.Context) sandwich_daemon.ConfigProvider
- func GetCustomBotConfiguration(customBotUUID uuid.UUID, botToken string, autoStart bool, ...) sandwich_daemon.ApplicationConfiguration
- func GetCustomBotEnvironmentType() string
- func GetCustomBotKey(v uuid.UUID) string
- func GetGuildCustomBotLimit(ctx context.Context, guildID discord.Snowflake) int
- func GetGuildMemberDisplayName(member *discord.GuildMember) string
- func GetHighestRoleForGuildMember(roleMap map[discord.Snowflake]AssignableRole, guildMember *discord.GuildMember) int32
- func GetManagerNameFromContext(ctx context.Context) string
- func GetOnboardingMessage(guildID discord.Snowflake) discord.MessageParams
- func GetRolePermissionList(permissions int) []string
- func GetRolePermissionListAsString(permissions int) string
- func GetSessionFromContext(ctx context.Context) (*discord.Session, bool)
- func GetUserAvatar(user *discord.User) string
- func GetUserDisplayName(user *discord.User) string
- func GetWelcomerPresence(ctx context.Context, guildID discord.Snowflake) (guildMembers []*discord.GuildMember, err error)
- func GuildMemberCanAssignRoles(guildMember *discord.GuildMember) bool
- func HandleDiscordEntitlement(ctx context.Context, entitlement discord.Entitlement) error
- func HandlePaypalSale(ctx context.Context, paypalSale PaypalSale) error
- func HandlePaypalSubscription(ctx context.Context, action string, paypalSubscription paypal.Subscription) error
- func HumanizeDuration(seconds int, includeSeconds bool) string
- func If[T any](condition bool, trueValue, falseValue T) T
- func IfFunc[T any](condition bool, trueFunc, falseFunc func() T) T
- func IncludeBorderwallVerifyButton(messageParams discord.MessageParams, borderwallLink string) discord.MessageParams
- func IncludeScamsButton(messageParams discord.MessageParams) discord.MessageParams
- func IncludeSentByButton(messageParams discord.MessageParams, guildName string) discord.MessageParams
- func Int64SliceToString(values []int64) []string
- func Int64ToStringPointer(value int64) *string
- func IsCustomBackgroundsMembership(membershipType database.MembershipType) bool
- func IsInterationAuthorElevated(sub *subway.Subway, interaction discord.Interaction) bool
- func IsJSONBEmpty(b []byte) bool
- func IsMessageParamsEmpty(m discord.MessageParams) bool
- func IsPublicIPAddress(address net.IP) bool
- func IsValidBackground(s string) bool
- func IsValidColour(str string) bool
- func IsValidDiscordToken(token string) bool
- func IsValidEmbed(s string) error
- func IsValidHex(str string, allowAlpha bool) bool
- func IsValidHostname(host string) bool
- func IsValidImageAlignment(value string) bool
- func IsValidImageProfileBorderType(value string) bool
- func IsValidImageTheme(value string) bool
- func IsValidInteger(str string) bool
- func IsValidPublicKey(publicKey string) bool
- func IsValidURL(url string) (*url.URL, bool)
- func IsValidURLWithFormatting(url string) (*url.URL, bool)
- func IsValidUnsplashID(str string) bool
- func IsWelcomerProMembership(membershipType database.MembershipType) bool
- func Itoa(v int64) string
- func JSONBToBytes(value pgtype.JSONB) []byte
- func JSONBToString(value pgtype.JSONB) string
- func LoadRSAKey(keyType KeyType) (interface{}, error)
- func MarshalTimeRolesJSON(roles []GuildSettingsTimeRolesRole) (rolesJSON []byte)
- func MemberHasElevation(discordGuild *discord.Guild, member *discord.GuildMember) bool
- func MustConvertToJSONB(v any) pgtype.JSONB
- func NewEmbed(message string, color int32) []discord.Embed
- func NewTwilightProxy(u string) discord.RESTInterface
- func NotifyMembershipCreated(ctx context.Context, session *discord.Session, ...) error
- func NotifyMembershipExpired(ctx context.Context, session *discord.Session, ...) error
- func OnDiscordEntitlementCreated(ctx context.Context, entitlement discord.Entitlement) error
- func OnDiscordEntitlementDeleted(ctx context.Context, entitlement discord.Entitlement) error
- func OnDiscordEntitlementUpdated(ctx context.Context, entitlement discord.Entitlement) error
- func OnMembershipExpired(ctx context.Context, membership database.GetUserMembershipsByUserIDRow) error
- func OnPatreonActive(ctx context.Context, patreonUser database.PatreonUsers, ...) error
- func OnPatreonLinked(ctx context.Context, patreonUser PatreonUser, automatic bool) error
- func OnPatreonNoLongerPledging(ctx context.Context, patreonUser database.PatreonUsers, ...) error
- func OnPatreonTierChanged(ctx context.Context, beforePatreonUser *database.PatreonUsers, ...) error
- func OnPatreonTierChanged_Fallback(ctx context.Context, beforePatreonUser *database.PatreonUsers, ...) error
- func OnPatreonUnlinked(ctx context.Context, patreonUser *database.PatreonUsers) error
- func OnPaypalSubscriptionActivated(ctx context.Context, paypalSubscription paypal.Subscription) error
- func OnPaypalSubscriptionCancelled(ctx context.Context, paypalSubscription paypal.Subscription) error
- func OnPaypalSubscriptionCreated(ctx context.Context, paypalSubscription paypal.Subscription) error
- func OnPaypalSubscriptionExpired(ctx context.Context, paypalSubscription paypal.Subscription) error
- func OnPaypalSubscriptionPaymentFailed(ctx context.Context, paypalSubscription paypal.Subscription) error
- func OnPaypalSubscriptionReactivated(ctx context.Context, paypalSubscription paypal.Subscription) error
- func OnPaypalSubscriptionSuspended(ctx context.Context, paypalSubscription paypal.Subscription) error
- func OnPaypalSubscriptionUpdated(ctx context.Context, paypalSubscription paypal.Subscription) error
- func Overflow(s string, length int) string
- func ParseColour(str, defaultValue string) (*color.RGBA, error)
- func ParseDurationAsSeconds(input string) (int, error)
- func RandStringBytesRmndr(n int) string
- func RemoveGuildFeatureWithAudit(ctx context.Context, params database.RemoveGuildFeatureParams, ...) error
- func RemoveMembershipFromServer(ctx context.Context, membership database.GetUserMembershipsByUserIDRow) (newMembership database.UpdateUserMembershipParams, err error)
- func RequireGuild(interaction discord.Interaction, handler BasicInteractionHandler) (*discord.InteractionResponse, error)
- func RequireGuildElevation(sub *subway.Subway, interaction discord.Interaction, ...) (*discord.InteractionResponse, error)
- func RetryWithFallback(function, fallbackFunction func() error, predictate func(error) bool) (err error)
- func SendWebhookMessage(ctx context.Context, webhookURL string, message discord.WebhookMessageParams) error
- func SetupDatabase(ctx context.Context, connectionString string)
- func SetupDedupeProvider(provider RedisDedupeProvider)
- func SetupDefaultManagerName(name string)
- func SetupGRPCConnection(host string, opts ...grpc.DialOption)
- func SetupJSONB(jsonb pgtype.JSONB) pgtype.JSONB
- func SetupLogger(loggingLevel string) io.Writer
- func SetupPushGuildScience(limit int) func(ctx context.Context, interval time.Duration)
- func SetupRESTInterface(restInterface discord.RESTInterface)
- func SetupSandwichClient()
- func SliceContains[T comparable](slice []T, value T) bool
- func StartCustomBot(ctx context.Context, customBotUUID uuid.UUID, botToken string, ...) error
- func StopCustomBot(ctx context.Context, customBotUUID uuid.UUID, blocking bool) error
- func StringPointerToInt64(value *string) int64
- func StringSliceToInt64(value []string) []int64
- func StringToJSONB(value string) pgtype.JSONB
- func StringToJsonLiteral(s string) json.RawMessage
- func ToPointer[K any](k K) *K
- func TruncateUTF8(s string, length int) string
- func TryGetURLFromContext(ctx context.Context) url.URL
- func TryParseBool(str string) bool
- func TryParseFloat(str string) float64
- func TryParseInt(str string) int64
- func TryParseTime(str string) time.Time
- func UpdateCustomBotWithAudit(ctx context.Context, params database.UpdateCustomBotParams, ...) (*database.CustomBots, error)
- func UpdateGuildWithAudit(ctx context.Context, params database.UpdateGuildParams, ...) (*database.Guilds, error)
- func ValidateRecaptcha(response, ipAddress string) (float64, error)
- type ApplicationValues
- type AssignableRole
- type Attributes
- type Background
- type BackgroundType
- type BasicIPChecker
- type BasicInteractionHandler
- type CompareStructResult
- type ContextKey
- type Currency
- type CustomEventInvokeBorderwallCompletionStructure
- type CustomEventInvokeBorderwallStructure
- type CustomEventInvokeLeaverStructure
- type CustomEventInvokeTempChannelsRemoveStructure
- type CustomEventInvokeTempChannelsStructure
- type CustomEventInvokeWelcomerStructure
- type CustomWelcomerImage
- type CustomWelcomerImageGenerateRequest
- type CustomWelcomerImageLayer
- type CustomWelcomerImageLayerType
- type CustomWelcomerImageLayerTypography
- type CustomWelcomerImageStroke
- type EnvironmentType
- type GenerateImageOptionsRaw
- type GetPatreonMembersResponse
- type GuildFeature
- type GuildScienceBorderwallChallenge
- type GuildScienceBorderwallCompleted
- type GuildScienceLeaverMessageRemoved
- type GuildScienceMembershipReceived
- type GuildScienceMembershipRemoved
- type GuildScienceTimeRoleGiven
- type GuildScienceUserJoined
- type GuildScienceUserLeftMessage
- type GuildScienceUserWelcomed
- type GuildScienceWelcomeMessageRemoved
- type GuildSettingsTimeRolesRole
- type GuildVariables
- type HorizontalAlignment
- type IPChecker
- type IPIntelError
- type IPIntelFlags
- type IPIntelOFlags
- type IPIntelResponse
- type ImageAlignment
- type ImageFileType
- type ImageProfileBorderType
- type ImageTheme
- type KeyType
- type LRUIPChecker
- type LastChargeStatus
- type OnInvokeBorderwallCompletionFuncType
- type OnInvokeBorderwallFuncType
- type OnInvokeLeaverFuncType
- type OnInvokeTempChannelsFuncType
- type OnInvokeTempChannelsRemoveFuncType
- type OnInvokeWelcomerFuncType
- type PatreonMember
- type PatreonTier
- type PatreonUser
- type PatreonUserOuter
- type PatreonUser_Attributes
- type PatreonUser_Discord
- type PatreonUser_SocialConnections
- type PatronSocialConnections
- type PatronStatus
- type PaypalSale
- type PricingSKU
- type PushGuildScienceHandler
- func (h *PushGuildScienceHandler) Flush(ctx context.Context)
- func (h *PushGuildScienceHandler) Push(ctx context.Context, guildID, userID discord.Snowflake, ...)
- func (h *PushGuildScienceHandler) PushRaw(ctx context.Context, event database.CreateManyScienceGuildEventsParams)
- func (h *PushGuildScienceHandler) Run(ctx context.Context, interval time.Duration)
- type RecaptchaRequest
- type RecaptchaResponse
- type RedisDedupeProvider
- type Relationships
- type SKUName
- type StubGuild
- type StubInvite
- type StubTime
- type StubUser
- type Timing
- type TimingEntry
- type TwilightProxy
- func (tl *TwilightProxy) Fetch(ctx context.Context, session *discord.Session, ...) ([]byte, error)
- func (tl *TwilightProxy) FetchBJ(ctx context.Context, session *discord.Session, ...) error
- func (tl *TwilightProxy) FetchJJ(ctx context.Context, session *discord.Session, method, endpoint string, ...) error
- func (tl *TwilightProxy) SetDebug(value bool)
- type UserAgentSetterTransport
- type UserProvidedEmbed
- type VerticalAlignment
- type WelcomerDatabaseConfigProvider
Constants ¶
const ( EmojiCheck = "<:check:1196902761627914402>" EmojiCross = "<:cross:1196902764048031744>" EmojiNeutral = "<:neutral:1196903241959620730>" EmojiRock = "<:rock:732274836038221855>" )
const ( EmbedColourInfo = 0x2F80ED EmbedColourSuccess = 0x4CD787 EmbedColourError = 0xFC6A70 EmbedColourWarn = 0xFBC01B )
const ( CustomEventInvokeWelcomer = "WELCOMER_INVOKE_WELCOMER" CustomEventInvokeLeaver = "WELCOMER_INVOKE_LEAVER" CustomEventInvokeTempChannels = "WELCOMER_INVOKE_TEMPCHANNELS" CustomEventInvokeTempChannelsRemove = "WELCOMER_INVOKE_TEMPCHANNELS_REMOVE" CustomEventInvokeBorderwall = "WELCOMER_INVOKE_BORDERWALL" CustomEventInvokeBorderwallCompletion = "WELCOMER_INVOKE_BORDERWALL_COMPLETION" )
const ( IPIntelFlagDefaultLookup IPIntelFlags = "" IPIntelFlagDynamicBanList IPIntelFlags = "m" IPIntelFlagDynamicBanListDynamicChecks IPIntelFlags = "b" IPIntelFlagForceFullLookup IPIntelFlags = "f" IPIntelOFlagOnlyBadIP IPIntelOFlags = "b" IPIntelOFlagShowCountry IPIntelOFlags = "c" IPIntelOFlagShowVPN IPIntelOFlags = "i" IPIntelOFlgagShowASN IPIntelOFlags = "a" )
const ( PatreonBase = "https://www.patreon.com/api/oauth2/v2/" CampaignID = "1150593" )
const ( MaxRuleCount = 25 MaxRuleLength = 250 )
const (
IPIntelEndpoint = "https://check.getipintel.net/check.php"
)
const PermissionElevated = discord.PermissionAdministrator | discord.PermissionManageServer
const (
RecaptchaEndpoint = "https://www.google.com/recaptcha/api/siteverify"
)
const (
UserAgent = "WelcomerService (https://github.com/WelcomerTeam/Welcomer)"
)
Variables ¶
var ( EmojiMessageBadge = discord.Emoji{ID: 987044175943970867, Name: "messagebadge"} EmojiShieldAlert = discord.Emoji{ID: 987044177160331322, Name: "shieldalert"} EmojiCheckMark = discord.Emoji{ID: 586907765662941185, Name: "checkboxmarkedoutline"} SupportInvite = "https://discord.gg/kQJz33ExK2" WebsiteURL = "https://" + os.Getenv("DOMAIN") // https://welcomer.gg )
var ( ErrInvalidColour = errors.New("colour format is not recognised") ErrMissingGuild = errors.New("missing guild") ErrMissingChannel = errors.New("missing channel") ErrMissingUser = errors.New("missing user") ErrMissingApplicationUser = errors.New("missing application user") ErrInvalidURL = errors.New("invalid url") ErrInvalidTempChannel = errors.New("channel is not a temporary channel") )
var ( CustomBackgroundPrefix = "custom:" SolidColourPrefix = "solid:" SolidColourPrefixBased = "profile" UnsplashPrefix = "unsplash:" StripesPrefix = "stripes:" RGBAPrefix = "rgba" RGBPrefix = "rgb" RGBRegex = regexp.MustCompile(`^rgb\(([0-9]+)(\w+)?, ([0-9]+)(\w+)?, ([0-9]+)(\w+)?\)$`) RGBARegex = regexp.MustCompile(`^rgba\(([0-9]+)(\w+)?, ([0-9]+)(\w+)?, ([0-9].+)(\w+)?\)$`) )
var ( ErrInvalidNoInput = errors.New("invalid no input") ErrInvalidIPAddress = errors.New("invalid ip address") ErrUnroutableAddress = errors.New("unroutable address / private address") ErrUnableToReachDatabase = errors.New("unable to reach database") ErrIPBannedOrNoPermission = errors.New("your connecting ip has been banned from the system or you do not have permission to access a particular service") ErrNoContactInfoOrInvalidContact = errors.New("you did not provide any contact information with your query or the contact information is invalid") )
var ( ErrMembershipAlreadyInUse = errors.New("membership is already in use") ErrMembershipInvalid = errors.New("membership is invalid") ErrMembershipExpired = errors.New("membership has expired") ErrMembershipNotInUse = errors.New("membership is not in use") ErrUnhandledMembership = errors.New("membership type is not handled") ErrTransactionNotComplete = errors.New("transaction not completed") ErrMissingPaypalTransaction = errors.New("missing paypal subscription transaction") ErrMissingPaypalUser = errors.New("missing user for paypal subscription transaction") )
var ( WelcomerProDiscordSKU = discord.Snowflake(TryParseInt(os.Getenv("WELCOMER_PRO_DISCORD_SKU_ID"))) WelcomerCustomBackgroundsDiscordSKU = discord.Snowflake(TryParseInt(os.Getenv("WELCOMER_CUSTOM_BACKGROUNDS_DISCORD_SKU_ID"))) )
var ( True = true False = false )
var CountryMapping = map[string]Currency{ "IN": CurrencyINR, }
var DefaultAutoroles database.GuildSettingsAutoroles = database.GuildSettingsAutoroles{ ToggleEnabled: false, Roles: []int64{}, }
var DefaultBorderwall database.GuildSettingsBorderwall = database.GuildSettingsBorderwall{ ToggleEnabled: false, ToggleSendDm: true, Channel: 0, MessageVerify: MustConvertToJSONB(discord.MessageParams{ Embeds: []discord.Embed{ { Description: "This server is protected by Borderwall. Please verify at {{Borderwall.Link}}.", Color: EmbedColourInfo, }, }, }), MessageVerified: MustConvertToJSONB(discord.MessageParams{ Embeds: []discord.Embed{ { Description: "Thank you for verifying! You now have access to the server.", Color: EmbedColourSuccess, }, }, }), RolesOnJoin: []int64{}, RolesOnVerify: []int64{}, }
var DefaultFreeRoles database.GuildSettingsFreeroles = database.GuildSettingsFreeroles{ ToggleEnabled: false, Roles: []int64{}, }
var DefaultGuild database.Guilds = database.Guilds{ EmbedColour: EmbedColourInfo, SiteSplashUrl: "", SiteStaffVisible: false, SiteGuildVisible: false, SiteAllowInvites: false, }
var DefaultLeaver database.GuildSettingsLeaver = database.GuildSettingsLeaver{ ToggleEnabled: false, Channel: 0, MessageFormat: MustConvertToJSONB(discord.MessageParams{ Content: "{{User.Name}} has left the server. We now have {{Guild.Members}} members.", }), AutoDeleteLeaverMessages: false, LeaverMessageLifetime: 0, }
var DefaultManagerName string
var DefaultRules database.GuildSettingsRules = database.GuildSettingsRules{ ToggleEnabled: false, ToggleDmsEnabled: true, Rules: []string{}, }
var DefaultTempChannels database.GuildSettingsTempchannels = database.GuildSettingsTempchannels{ ToggleEnabled: false, ToggleAutopurge: true, ChannelLobby: 0, ChannelCategory: 0, DefaultUserCount: 0, }
var DefaultTimeRoles database.GuildSettingsTimeroles = database.GuildSettingsTimeroles{ ToggleEnabled: false, Timeroles: pgtype.JSONB{Status: pgtype.Null}, }
var DefaultWelcomer database.GuildSettingsWelcomer = database.GuildSettingsWelcomer{ AutoDeleteWelcomeMessages: false, WelcomeMessageLifetime: 0, AutoDeleteWelcomeMessagesOnLeave: false, }
var DefaultWelcomerDms database.GuildSettingsWelcomerDms = database.GuildSettingsWelcomerDms{ ToggleEnabled: false, ToggleUseTextFormat: true, ToggleIncludeImage: true, MessageFormat: MustConvertToJSONB(discord.MessageParams{ Content: "Welcome {{User.Mention}} to **{{Guild.Name}}**! You are the {{Ordinal(Guild.Members)}} member!", }), }
var DefaultWelcomerImages database.GuildSettingsWelcomerImages = database.GuildSettingsWelcomerImages{ ToggleEnabled: false, ToggleImageBorder: true, ToggleShowAvatar: true, BackgroundName: "solid:profile", ColourText: "#FFFFFF", ColourTextBorder: "#000000", ColourImageBorder: "#FFFFFF", ColourProfileBorder: "#FFFFFF", ImageAlignment: int32(ImageAlignmentLeft), ImageTheme: int32(ImageThemeDefault), ImageMessage: "Welcome {{User.Name}}\nto {{Guild.Name}}you are the {{Ordinal(Guild.Members)}} member!", ImageProfileBorderType: int32(ImageProfileBorderTypeCircular), UseCustomBuilder: false, CustomBuilderData: pgtype.JSONB{ Status: pgtype.Present, Bytes: []byte("{}"), }, }
var DefaultWelcomerText database.GuildSettingsWelcomerText = database.GuildSettingsWelcomerText{ ToggleEnabled: false, Channel: 0, MessageFormat: MustConvertToJSONB(discord.MessageParams{ Content: "Welcome {{User.Mention}} to **{{Guild.Name}}**! You are the {{Ordinal(Guild.Members)}} member!", }), }
var DiscordPaymentsWebhookURL = os.Getenv("DISCORD_PAYMENTS_WEBHOOK_URL")
var ElevatedUsers []discord.Snowflake
var ErrInvalidBackgroundType = errors.New("not a valid BackgroundType")
var ErrInvalidGuildFeature = errors.New("not a valid GuildFeature")
var ErrInvalidImageAlignment = errors.New("not a valid ImageAlignment")
var ErrInvalidImageFileType = errors.New("not a valid ImageFileType")
var ErrInvalidImageProfileBorderType = errors.New("not a valid ImageProfileBorderType")
var ErrInvalidImageTheme = errors.New("not a valid ImageTheme")
var GRPCConnection *grpc.ClientConn
var GlobalCurrencies = []Currency{CurrencyEUR, CurrencyGBP, CurrencyUSD}
var Logger zerolog.Logger
var OptinGuildFeatures = map[GuildFeature]bool{ GuildFeatureCustomWelcomerImageBuilder: true, }
var Pool *pgxpool.Pool
var Queries *database.Queries
var RESTInterface discord.RESTInterface
var SKUPricingTable = map[int]map[SKUName]PricingSKU{ 0: { SKUCustomBackgrounds: { ID: SKUCustomBackgrounds, Name: "Custom Backgrounds", Description: "One-time purchase to unlock custom welcome backgrounds for your server.", MembershipType: database.MembershipTypeCustomBackgrounds, SoftDescriptor: "Backgrounds", MonthCount: -1, Costs: map[Currency]string{ CurrencyEUR: "12.00", CurrencyGBP: "10.00", CurrencyUSD: "12.00", CurrencyINR: "300", }, }, SKUWelcomerPro: { ID: SKUWelcomerPro, Name: "Welcomer Pro", Description: "Unlock all Welcomer Pro features for your server.", MembershipType: database.MembershipTypeWelcomerPro, SoftDescriptor: "Pro", MonthCount: 1, Costs: map[Currency]string{ CurrencyEUR: "8.00", CurrencyGBP: "7.00", CurrencyUSD: "8.00", CurrencyINR: "300", }, IsRecurring: os.Getenv("WELCOMER_PRO_RECURRING") == "true", PaypalSubscriptionID: map[Currency]string{ CurrencyEUR: os.Getenv("WELCOMER_PRO_PAYPAL_SUBSCRIPTION_EUR_ID"), CurrencyGBP: os.Getenv("WELCOMER_PRO_PAYPAL_SUBSCRIPTION_GBP_ID"), CurrencyUSD: os.Getenv("WELCOMER_PRO_PAYPAL_SUBSCRIPTION_USD_ID"), }, }, SKUWelcomerProBiAnnual: { ID: SKUWelcomerProBiAnnual, Name: "Welcomer Pro", Description: "Unlock all Welcomer Pro features for your server.", MembershipType: database.MembershipTypeWelcomerPro, SoftDescriptor: "Pro", MonthCount: 6, Costs: map[Currency]string{ CurrencyEUR: "40.00", CurrencyGBP: "35.00", CurrencyUSD: "40.00", CurrencyINR: "1500", }, }, SKUWelcomerProAnnual: { ID: SKUWelcomerProAnnual, Name: "Welcomer Pro", Description: "Unlock all Welcomer Pro features for your server.", MembershipType: database.MembershipTypeWelcomerPro, SoftDescriptor: "Pro", MonthCount: 12, Costs: map[Currency]string{ CurrencyEUR: "80.00", CurrencyGBP: "70.00", CurrencyUSD: "80.00", CurrencyINR: "3000", }, }, }, 1: { SKUCustomBackgrounds: { ID: SKUCustomBackgrounds, Name: "Custom Backgrounds", Description: "One-time purchase to unlock custom welcome backgrounds for your server.", MembershipType: database.MembershipTypeCustomBackgrounds, SoftDescriptor: "Backgrounds", MonthCount: -1, Costs: map[Currency]string{ CurrencyEUR: "9.00", CurrencyGBP: "7.50", CurrencyUSD: "9.00", CurrencyINR: "225", }, }, SKUWelcomerPro: { ID: SKUWelcomerPro, Name: "Welcomer Pro", Description: "Unlock all Welcomer Pro features for your server.", MembershipType: database.MembershipTypeWelcomerPro, SoftDescriptor: "Pro", MonthCount: 1, Costs: map[Currency]string{ CurrencyEUR: "6.00", CurrencyGBP: "5.25", CurrencyUSD: "6.00", CurrencyINR: "250", }, }, SKUWelcomerProBiAnnual: { ID: SKUWelcomerProBiAnnual, Name: "Welcomer Pro", Description: "Unlock all Welcomer Pro features for your server.", MembershipType: database.MembershipTypeWelcomerPro, SoftDescriptor: "Pro", MonthCount: 6, Costs: map[Currency]string{ CurrencyEUR: "30.00", CurrencyGBP: "26.25", CurrencyUSD: "30.00", CurrencyINR: "1125", }, }, SKUWelcomerProAnnual: { ID: SKUWelcomerProAnnual, Name: "Welcomer Pro", Description: "Unlock all Welcomer Pro features for your server.", MembershipType: database.MembershipTypeWelcomerPro, SoftDescriptor: "Pro", MonthCount: 12, Costs: map[Currency]string{ CurrencyEUR: "60.00", CurrencyGBP: "52.50", CurrencyUSD: "80.00", CurrencyINR: "2250", }, }, }, }
var SandwichClient sandwich.SandwichClient
var UUIDGen = uuid.NewGen()
Functions ¶
func AcquireSession ¶
func AddManagerNameToContext ¶
func AddMembershipToServer ¶
func AddMembershipToServer(ctx context.Context, membership database.GetUserMembershipsByUserIDRow, guildID discord.Snowflake) (newMembership database.UpdateUserMembershipParams, err error)
func AddSessionToContext ¶
func AssertLength ¶
func AssertMaxLength ¶
func AssertMinLength ¶
func AuditChange ¶
func BytesToJSONB ¶
func CanAssignRole ¶
func CheckChannelGuild ¶
func CheckChannelGuild(ctx context.Context, c sandwich_protobuf.SandwichClient, guildID, channelID discord.Snowflake) (bool, error)
func CompareStrings ¶
func CompareStructsAsJSON ¶
func CompareStructsAsJSON[T comparable](oldStruct, newStruct T) ([]byte, bool, error)
func ConvertToRGBA ¶
func CreateBorderwallRequestWithAudit ¶
func CreateBorderwallRequestWithAudit(ctx context.Context, params database.CreateBorderwallRequestParams, actor discord.Snowflake) (*database.BorderwallRequests, error)
func CreateCustomBotWithAudit ¶
func CreateCustomBotWithAudit(ctx context.Context, params database.CreateCustomBotParams, actor discord.Snowflake) (*database.CustomBots, error)
func CreateGuildWithAudit ¶
func CreateGuildWithAudit(ctx context.Context, params database.CreateGuildParams, actor discord.Snowflake) (*database.Guilds, error)
CreateGuildWithAudit wraps CreateGuild and audits the creation of a guild row.
func CreateMembershipForUser ¶
func CreateOrUpdateAutoRolesGuildSettingsWithAudit ¶
func CreateOrUpdateAutoRolesGuildSettingsWithAudit(ctx context.Context, params database.CreateOrUpdateAutoRolesGuildSettingsParams, actor discord.Snowflake) (*database.GuildSettingsAutoroles, error)
Generic wrappers for guild settings create/update operations.
func CreateOrUpdateBorderwallGuildSettingsWithAudit ¶
func CreateOrUpdateBorderwallGuildSettingsWithAudit(ctx context.Context, params database.CreateOrUpdateBorderwallGuildSettingsParams, actor discord.Snowflake) (*database.GuildSettingsBorderwall, error)
func CreateOrUpdateFreeRolesGuildSettingsWithAudit ¶
func CreateOrUpdateFreeRolesGuildSettingsWithAudit(ctx context.Context, params database.CreateOrUpdateFreeRolesGuildSettingsParams, actor discord.Snowflake) (*database.GuildSettingsFreeroles, error)
func CreateOrUpdateLeaverGuildSettingsWithAudit ¶
func CreateOrUpdateLeaverGuildSettingsWithAudit(ctx context.Context, params database.CreateOrUpdateLeaverGuildSettingsParams, actor discord.Snowflake) (*database.GuildSettingsLeaver, error)
func CreateOrUpdateRulesGuildSettingsWithAudit ¶
func CreateOrUpdateRulesGuildSettingsWithAudit(ctx context.Context, params database.CreateOrUpdateRulesGuildSettingsParams, actor discord.Snowflake) (*database.GuildSettingsRules, error)
func CreateOrUpdateTempChannelsGuildSettingsWithAudit ¶
func CreateOrUpdateTempChannelsGuildSettingsWithAudit(ctx context.Context, params database.CreateOrUpdateTempChannelsGuildSettingsParams, actor discord.Snowflake) (*database.GuildSettingsTempchannels, error)
func CreateOrUpdateTimeRolesGuildSettingsWithAudit ¶
func CreateOrUpdateTimeRolesGuildSettingsWithAudit(ctx context.Context, params database.CreateOrUpdateTimeRolesGuildSettingsParams, actor discord.Snowflake) (*database.GuildSettingsTimeroles, error)
func CreateOrUpdateUserWithAudit ¶
func CreateOrUpdateUserWithAudit(ctx context.Context, params database.CreateOrUpdateUserParams, actor discord.Snowflake) (*database.Users, error)
CreateOrUpdateUserWithAudit wraps Queries.CreateOrUpdateUser and logs an audit entry when changes are detected. It will attempt to fetch the existing user row (if any), call AuditChange comparing old and new, then perform the DB operation and return the resulting row.
func CreateOrUpdateWelcomerDMsGuildSettingsWithAudit ¶
func CreateOrUpdateWelcomerDMsGuildSettingsWithAudit(ctx context.Context, params database.CreateOrUpdateWelcomerDMsGuildSettingsParams, actor discord.Snowflake) (*database.GuildSettingsWelcomerDms, error)
func CreateOrUpdateWelcomerGuildSettingsWithAudit ¶
func CreateOrUpdateWelcomerGuildSettingsWithAudit(ctx context.Context, params database.CreateOrUpdateWelcomerGuildSettingsParams, actor discord.Snowflake) (*database.GuildSettingsWelcomer, error)
func CreateOrUpdateWelcomerImagesGuildSettingsWithAudit ¶
func CreateOrUpdateWelcomerImagesGuildSettingsWithAudit(ctx context.Context, params database.CreateOrUpdateWelcomerImagesGuildSettingsParams, actor discord.Snowflake) (*database.GuildSettingsWelcomerImages, error)
func CreateOrUpdateWelcomerTextGuildSettingsWithAudit ¶
func CreateOrUpdateWelcomerTextGuildSettingsWithAudit(ctx context.Context, params database.CreateOrUpdateWelcomerTextGuildSettingsParams, actor discord.Snowflake) (*database.GuildSettingsWelcomerText, error)
func CreateTransactionForUser ¶
func CreateTransactionForUser(ctx context.Context, userID discord.Snowflake, platformType database.PlatformType, transactionStatus database.TransactionStatus, transactionID, currencyCode, amount string) (*database.UserTransactions, error)
func CreateUserWithAudit ¶
func CreateWelcomerImagesWithAudit ¶
func CreateWelcomerImagesWithAudit(ctx context.Context, params database.CreateWelcomerImagesParams, actor discord.Snowflake) (*database.WelcomerImages, error)
Simple create wrappers for non-guild-specific objects.
func EnsureGuild ¶
EnsureGuild will create or update a guild entry. This requires RequireMutualGuild to be called.
func EscapeStringForJSON ¶
EscapeStringForJSON escapes a string for JSON.
func FetchGuild ¶
func FetchGuildChannels ¶
func FilterAssignableRoles ¶
func FormatNumber ¶
func FormatNumber(value int64, locale database.NumberLocale) string
func FormatString ¶
func FormatTextStroke ¶
func GatherFunctions ¶
func GatherFunctions(numberLocale database.NumberLocale) (funcs map[string]govaluate.ExpressionFunction)
func GatherVariables ¶
func GatherVariables(eventCtx *sandwich.EventContext, member *discord.GuildMember, guild GuildVariables, invite *discord.Invite, extraValues map[string]any) (vars map[string]any)
func GetConfigurationGatherer ¶
func GetConfigurationGatherer(ctx context.Context) sandwich_daemon.ConfigProvider
func GetCustomBotConfiguration ¶
func GetCustomBotConfiguration(customBotUUID uuid.UUID, botToken string, autoStart bool, guildID discord.Snowflake) sandwich_daemon.ApplicationConfiguration
func GetCustomBotEnvironmentType ¶
func GetCustomBotEnvironmentType() string
func GetCustomBotKey ¶
func GetGuildCustomBotLimit ¶
func GetGuildMemberDisplayName ¶
func GetGuildMemberDisplayName(member *discord.GuildMember) string
func GetHighestRoleForGuildMember ¶
func GetHighestRoleForGuildMember(roleMap map[discord.Snowflake]AssignableRole, guildMember *discord.GuildMember) int32
func GetOnboardingMessage ¶
func GetOnboardingMessage(guildID discord.Snowflake) discord.MessageParams
func GetRolePermissionList ¶
func GetSessionFromContext ¶
func GetUserAvatar ¶
func GetUserDisplayName ¶
func GetWelcomerPresence ¶
func GuildMemberCanAssignRoles ¶
func GuildMemberCanAssignRoles(guildMember *discord.GuildMember) bool
func HandleDiscordEntitlement ¶
func HandleDiscordEntitlement(ctx context.Context, entitlement discord.Entitlement) error
func HandlePaypalSale ¶
func HandlePaypalSale(ctx context.Context, paypalSale PaypalSale) error
Handles all paypal sales.
func HandlePaypalSubscription ¶
func HandlePaypalSubscription(ctx context.Context, action string, paypalSubscription paypal.Subscription) error
Handles all subscription events.
func HumanizeDuration ¶
func IncludeBorderwallVerifyButton ¶
func IncludeBorderwallVerifyButton(messageParams discord.MessageParams, borderwallLink string) discord.MessageParams
func IncludeScamsButton ¶
func IncludeScamsButton(messageParams discord.MessageParams) discord.MessageParams
func IncludeSentByButton ¶
func IncludeSentByButton(messageParams discord.MessageParams, guildName string) discord.MessageParams
func Int64SliceToString ¶
func Int64ToStringPointer ¶
func IsCustomBackgroundsMembership ¶
func IsCustomBackgroundsMembership(membershipType database.MembershipType) bool
func IsInterationAuthorElevated ¶
func IsInterationAuthorElevated(sub *subway.Subway, interaction discord.Interaction) bool
func IsJSONBEmpty ¶
IsJSONBEmpty checks if a byte slice is empty or is a JSON empty object.
func IsMessageParamsEmpty ¶
func IsMessageParamsEmpty(m discord.MessageParams) bool
IsMessageParamsEmpty checks if the given message parameters are empty. It returns true if the content and all the fields in the embeds are empty, otherwise it returns false.
func IsPublicIPAddress ¶
func IsValidBackground ¶
func IsValidColour ¶
func IsValidDiscordToken ¶
func IsValidEmbed ¶
func IsValidHex ¶
func IsValidHostname ¶
func IsValidImageAlignment ¶
func IsValidImageTheme ¶
func IsValidInteger ¶
func IsValidPublicKey ¶
func IsValidUnsplashID ¶
func IsWelcomerProMembership ¶
func IsWelcomerProMembership(membershipType database.MembershipType) bool
func JSONBToBytes ¶
func JSONBToString ¶
func LoadRSAKey ¶
LoadRSAKey loads an RSA public or private key from a file specified in environment variable
func MarshalTimeRolesJSON ¶
func MarshalTimeRolesJSON(roles []GuildSettingsTimeRolesRole) (rolesJSON []byte)
func MemberHasElevation ¶
func MemberHasElevation(discordGuild *discord.Guild, member *discord.GuildMember) bool
func MustConvertToJSONB ¶
func NewTwilightProxy ¶
func NewTwilightProxy(u string) discord.RESTInterface
func NotifyMembershipCreated ¶
func NotifyMembershipExpired ¶
func OnDiscordEntitlementCreated ¶
func OnDiscordEntitlementCreated(ctx context.Context, entitlement discord.Entitlement) error
func OnDiscordEntitlementDeleted ¶
func OnDiscordEntitlementDeleted(ctx context.Context, entitlement discord.Entitlement) error
func OnDiscordEntitlementUpdated ¶
func OnDiscordEntitlementUpdated(ctx context.Context, entitlement discord.Entitlement) error
func OnMembershipExpired ¶
func OnMembershipExpired(ctx context.Context, membership database.GetUserMembershipsByUserIDRow) error
Triggers when a membership has expired and not renewed.
func OnPatreonActive ¶
func OnPatreonActive(ctx context.Context, patreonUser database.PatreonUsers, patreonMember PatreonMember) error
Triggered when a patron is still pledging.
func OnPatreonLinked ¶
func OnPatreonLinked(ctx context.Context, patreonUser PatreonUser, automatic bool) error
Triggers when a patreon account has been linked.
func OnPatreonNoLongerPledging ¶
func OnPatreonNoLongerPledging(ctx context.Context, patreonUser database.PatreonUsers, patreonMember PatreonMember) error
Triggers when a patron is no longer pledging
func OnPatreonTierChanged ¶
func OnPatreonTierChanged(ctx context.Context, beforePatreonUser *database.PatreonUsers, patreonUser database.CreateOrUpdatePatreonUserParams) error
Triggers when a patreon tier has changed.
func OnPatreonTierChanged_Fallback ¶
func OnPatreonTierChanged_Fallback(ctx context.Context, beforePatreonUser *database.PatreonUsers, patreonUser database.CreateOrUpdatePatreonUserParams, e error) error
Triggers when a patreon tier has changed. Ran if OnPatreonTierChange failed to run.
func OnPatreonUnlinked ¶
func OnPatreonUnlinked(ctx context.Context, patreonUser *database.PatreonUsers) error
Triggers when a patreon account has been unlinked.
func OnPaypalSubscriptionActivated ¶
func OnPaypalSubscriptionActivated(ctx context.Context, paypalSubscription paypal.Subscription) error
Triggers when a subscription has been activated.
func OnPaypalSubscriptionCancelled ¶
func OnPaypalSubscriptionCancelled(ctx context.Context, paypalSubscription paypal.Subscription) error
Triggers when a subscription has been cancelled.
func OnPaypalSubscriptionCreated ¶
func OnPaypalSubscriptionCreated(ctx context.Context, paypalSubscription paypal.Subscription) error
Triggers when a subscription is created.
func OnPaypalSubscriptionExpired ¶
func OnPaypalSubscriptionExpired(ctx context.Context, paypalSubscription paypal.Subscription) error
Triggers when a subscription has expired.
func OnPaypalSubscriptionPaymentFailed ¶
func OnPaypalSubscriptionPaymentFailed(ctx context.Context, paypalSubscription paypal.Subscription) error
Triggers when a subscription payment has failed.
func OnPaypalSubscriptionReactivated ¶
func OnPaypalSubscriptionReactivated(ctx context.Context, paypalSubscription paypal.Subscription) error
Triggers when a subscription has been re-activated.
func OnPaypalSubscriptionSuspended ¶
func OnPaypalSubscriptionSuspended(ctx context.Context, paypalSubscription paypal.Subscription) error
Triggers when a subscription has been suspended.
func OnPaypalSubscriptionUpdated ¶
func OnPaypalSubscriptionUpdated(ctx context.Context, paypalSubscription paypal.Subscription) error
Triggers when a subscription has been updated.
func ParseColour ¶
ParseColour parses a colour and returns RGBA. Expected formats: #FFAAAA #FFAAAAFF RGBA(255, 255, 255, 0.1) RGB(255, 255, 255)
func ParseDurationAsSeconds ¶
func RandStringBytesRmndr ¶
func RemoveMembershipFromServer ¶
func RemoveMembershipFromServer(ctx context.Context, membership database.GetUserMembershipsByUserIDRow) (newMembership database.UpdateUserMembershipParams, err error)
func RequireGuild ¶
func RequireGuild(interaction discord.Interaction, handler BasicInteractionHandler) (*discord.InteractionResponse, error)
func RequireGuildElevation ¶
func RequireGuildElevation(sub *subway.Subway, interaction discord.Interaction, handler BasicInteractionHandler) (*discord.InteractionResponse, error)
func RetryWithFallback ¶
func RetryWithFallback(function, fallbackFunction func() error, predictate func(error) bool) (err error)
RetryWithFallback will attempt to run a function. If the function fails, it will run a fallback function. predictate is a function that will determine if the error is retryable and is optional. When the fallback function succeeds, the original function will be called again.
func SendWebhookMessage ¶
func SetupDatabase ¶
func SetupDedupeProvider ¶
func SetupDedupeProvider(provider RedisDedupeProvider)
func SetupDefaultManagerName ¶
func SetupDefaultManagerName(name string)
func SetupGRPCConnection ¶
func SetupGRPCConnection(host string, opts ...grpc.DialOption)
func SetupLogger ¶
func SetupPushGuildScience ¶
func SetupRESTInterface ¶
func SetupRESTInterface(restInterface discord.RESTInterface)
func SetupSandwichClient ¶
func SetupSandwichClient()
func SliceContains ¶
func SliceContains[T comparable](slice []T, value T) bool
func StartCustomBot ¶
func StopCustomBot ¶
func StringPointerToInt64 ¶
func StringSliceToInt64 ¶
func StringToJSONB ¶
func StringToJsonLiteral ¶
func StringToJsonLiteral(s string) json.RawMessage
StringToJsonLiteral converts a string to a json.RawMessage.
func TruncateUTF8 ¶
func TryParseBool ¶
func TryParseFloat ¶
func TryParseInt ¶
func TryParseTime ¶
func UpdateCustomBotWithAudit ¶
func UpdateCustomBotWithAudit(ctx context.Context, params database.UpdateCustomBotParams, actor, guildID discord.Snowflake) (*database.CustomBots, error)
func UpdateGuildWithAudit ¶
func ValidateRecaptcha ¶
Types ¶
type ApplicationValues ¶
type AssignableRole ¶
type AssignableRole struct {
*discord.Role
IsAssignable bool `json:"is_assignable"`
IsElevated bool `json:"is_elevated"`
}
func CalculateRoleValues ¶
func CalculateRoleValues(roles []*discord.Role, guildMembers []*discord.GuildMember) (convertedRoles []*AssignableRole)
type Attributes ¶
type Attributes struct {
CurrentlyEntitledAmountCents int64 `json:"currently_entitled_amount_cents"`
Email string `json:"email"`
FullName string `json:"full_name"`
ThumbUrl string `json:"thumb_url"`
IsFollower bool `json:"is_follower"`
LastChargeDate time.Time `json:"last_charge_date"`
LastChargeStatus LastChargeStatus `json:"last_charge_status"`
LifetimeSupportCents int64 `json:"lifetime_support_cents"`
PatronStatus PatronStatus `json:"patron_status"`
SocialConnections PatronSocialConnections `json:"social_connections"`
}
type Background ¶
type Background struct {
Value string `json:"value"`
Type BackgroundType `json:"type"`
}
func ParseBackground ¶
func ParseBackground(str string) (Background, bool)
ParseBackground parses a background string provided by user. Expected formats: solid:FFAAAA - Solid colour with HEX code. solid:profile - Solid colour based on user profile picture. unsplash:Bnr_ZSmqbDY - Unsplash along with Id. custom:018c186a-4ce5-74c7-b2d1-b0639c2f4686 - per-guild background
type BackgroundType ¶
type BackgroundType int32
ENUM(default, welcomer, solid, solidProfile, unsplash, url, stripes)
const ( // BackgroundTypeDefault is a BackgroundType of type Default. BackgroundTypeDefault BackgroundType = iota // BackgroundTypeWelcomer is a BackgroundType of type Welcomer. BackgroundTypeWelcomer // BackgroundTypeSolid is a BackgroundType of type Solid. BackgroundTypeSolid // BackgroundTypeSolidProfile is a BackgroundType of type SolidProfile. BackgroundTypeSolidProfile // BackgroundTypeUnsplash is a BackgroundType of type Unsplash. BackgroundTypeUnsplash // BackgroundTypeUrl is a BackgroundType of type Url. BackgroundTypeUrl // BackgroundTypeStripes is a BackgroundType of type Stripes. BackgroundTypeStripes )
func ParseBackgroundType ¶
func ParseBackgroundType(name string) (BackgroundType, error)
ParseBackgroundType attempts to convert a string to a BackgroundType.
func (*BackgroundType) AppendText ¶
func (x *BackgroundType) AppendText(b []byte) ([]byte, error)
AppendText appends the textual representation of itself to the end of b (allocating a larger slice if necessary) and returns the updated slice.
Implementations must not retain b, nor mutate any bytes within b[:len(b)].
func (BackgroundType) IsValid ¶
func (x BackgroundType) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (BackgroundType) MarshalText ¶
func (x BackgroundType) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (BackgroundType) String ¶
func (x BackgroundType) String() string
String implements the Stringer interface.
func (*BackgroundType) UnmarshalText ¶
func (x *BackgroundType) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type BasicIPChecker ¶
type BasicIPChecker struct{}
func NewBasicIPChecker ¶
func NewBasicIPChecker() *BasicIPChecker
NewBasicIPChecker creates a new basic IP checker.
func (*BasicIPChecker) CheckIP ¶
func (c *BasicIPChecker) CheckIP(ctx context.Context, ipaddress string, flags IPIntelFlags, oflags IPIntelOFlags) (IPIntelResponse, error)
type BasicInteractionHandler ¶
type BasicInteractionHandler func() (*discord.InteractionResponse, error)
type CompareStructResult ¶
func CompareStructs ¶
func CompareStructs[T comparable](oldStruct, newStruct T) (CompareStructResult, bool)
type ContextKey ¶
type ContextKey int
const ( ManagerNameContextKey ContextKey = iota SessionContextKey )
type CustomEventInvokeBorderwallCompletionStructure ¶
type CustomEventInvokeBorderwallCompletionStructure struct {
Member discord.GuildMember
}
type CustomEventInvokeBorderwallStructure ¶
type CustomEventInvokeBorderwallStructure struct {
Member discord.GuildMember
}
type CustomEventInvokeTempChannelsRemoveStructure ¶
type CustomEventInvokeTempChannelsRemoveStructure struct {
Interaction *discord.Interaction
Member discord.GuildMember
}
type CustomEventInvokeTempChannelsStructure ¶
type CustomEventInvokeTempChannelsStructure struct {
Interaction *discord.Interaction
Member discord.GuildMember
}
type CustomEventInvokeWelcomerStructure ¶
type CustomEventInvokeWelcomerStructure struct {
Interaction *discord.Interaction
Member discord.GuildMember
IgnoreDedupe bool
}
type CustomWelcomerImage ¶
type CustomWelcomerImage struct {
Fill string `json:"fill"`
Stroke *CustomWelcomerImageStroke `json:"stroke,omitempty"`
Dimensions [2]int `json:"dimensions"`
Layers []CustomWelcomerImageLayer `json:"layers"`
}
type CustomWelcomerImageGenerateRequest ¶
type CustomWelcomerImageGenerateRequest struct {
CustomWelcomerImage CustomWelcomerImage `json:"custom_welcomer_image"`
MembersJoined int32 `json:"members_joined"`
NumberLocale database.NumberLocale `json:"number_locale"`
Guild discord.Guild `json:"guild"`
User discord.User `json:"user"`
Invite *discord.Invite `json:"invite,omitempty"`
}
type CustomWelcomerImageLayer ¶
type CustomWelcomerImageLayer struct {
Type CustomWelcomerImageLayerType `json:"type,omitempty"`
Value string `json:"value"`
Dimensions [2]int `json:"dimensions"`
Position [2]int `json:"position"`
Rotation int `json:"rotation"`
InvertedX bool `json:"inverted_x"`
InvertedY bool `json:"inverted_y"`
// BorderRadius will either be an integer or a percentage string.
BorderRadius [4]string `json:"border_radius"`
Fill string `json:"fill,omitempty"`
Stroke *CustomWelcomerImageStroke `json:"stroke,omitempty"`
Typography *CustomWelcomerImageLayerTypography `json:"typography,omitempty"`
}
type CustomWelcomerImageLayerType ¶
type CustomWelcomerImageLayerType int
const ( CustomWelcomerImageLayerTypeText CustomWelcomerImageLayerType = iota CustomWelcomerImageLayerTypeImage CustomWelcomerImageLayerTypeShapeRectangle CustomWelcomerImageLayerTypeShapeCircle )
type CustomWelcomerImageLayerTypography ¶
type CustomWelcomerImageLayerTypography struct {
FontFamily string `json:"font_family"`
FontWeight string `json:"font_weight"`
FontSize int `json:"font_size"`
LineHeight float64 `json:"line_height"`
LetterSpacing float64 `json:"letter_spacing"`
HorizontalAlignment HorizontalAlignment `json:"horizontal_alignment"`
VerticalAlignment VerticalAlignment `json:"vertical_alignment"`
}
type EnvironmentType ¶
type EnvironmentType int
const ( EnvironmentTypeDevelopment EnvironmentType = iota EnvironmentTypeProduction EnvironmentTypeProductionOutsideDocker )
type GenerateImageOptionsRaw ¶
type GenerateImageOptionsRaw struct {
ShowAvatar bool
AvatarURL string
Background string
Text string
TextFont string
TextColor int64
UserID int64
ProfileBorderColor int64
GuildID int64
ImageBorderColor int64
TextStrokeColor int64
Theme int32
TextAlign int32
ImageBorderWidth int32
ProfileFloat int32
ProfileBorderWidth int32
ProfileBorderCurve int32
TextStroke bool
AllowAnimated bool
}
type GetPatreonMembersResponse ¶
type GetPatreonMembersResponse struct {
Data []struct {
Attributes Attributes `json:"attributes"`
Relationships Relationships `json:"relationships"`
} `json:"data"`
Included []struct {
Attributes Attributes `json:"attributes"`
ID discord.Snowflake `json:"id"`
Type string `json:"type"`
}
Links struct {
Next string `json:"next"`
} `json:"links"`
}
type GuildFeature ¶
type GuildFeature string
ENUM(CustomWelcomerImageBuilder)
const ( // GuildFeatureCustomWelcomerImageBuilder is a GuildFeature of type CustomWelcomerImageBuilder. GuildFeatureCustomWelcomerImageBuilder GuildFeature = "CustomWelcomerImageBuilder" )
func CheckGuildMemberships ¶
func ParseGuildFeature ¶
func ParseGuildFeature(name string) (GuildFeature, error)
ParseGuildFeature attempts to convert a string to a GuildFeature.
func (*GuildFeature) AppendText ¶
func (x *GuildFeature) AppendText(b []byte) ([]byte, error)
AppendText appends the textual representation of itself to the end of b (allocating a larger slice if necessary) and returns the updated slice.
Implementations must not retain b, nor mutate any bytes within b[:len(b)].
func (GuildFeature) IsValid ¶
func (x GuildFeature) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (GuildFeature) MarshalText ¶
func (x GuildFeature) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (GuildFeature) String ¶
func (x GuildFeature) String() string
String implements the Stringer interface.
func (*GuildFeature) UnmarshalText ¶
func (x *GuildFeature) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type GuildScienceUserJoined ¶
type GuildScienceUserJoined struct {
HasInviteTracking bool `json:"has_invite_tracking,omitempty"`
IsInviteTracked bool `json:"is_invite_tracked,omitempty"`
InviteCode string `json:"invite_code,omitempty"`
MemberCount int32 `json:"member_count,omitempty"`
IsPending bool `json:"is_pending,omitempty"`
}
type GuildScienceUserWelcomed ¶
type GuildScienceUserWelcomed struct {
HasImage bool `json:"has_image,omitempty"`
HasMessage bool `json:"has_message,omitempty"`
MessageID discord.Snowflake `json:"message_id,omitempty"`
MessageChannelID discord.Snowflake `json:"channel_id,omitempty"`
HasDM bool `json:"has_dm,omitempty"`
HasInviteTracking bool `json:"has_invite_tracking,omitempty"`
IsInviteTracked bool `json:"is_invite_tracked,omitempty"`
InviteCode string `json:"invite_code,omitempty"`
}
type GuildSettingsTimeRolesRole ¶
type GuildSettingsTimeRolesRole struct {
Role discord.Snowflake `json:"role_id"`
Seconds int `json:"seconds"`
}
func FilterAssignableTimeRoles ¶
func FilterAssignableTimeRoles(ctx context.Context, sandwichClient pb.SandwichClient, guildID, applicationID int64, timeRoles []GuildSettingsTimeRolesRole) (out []GuildSettingsTimeRolesRole, err error)
func UnmarshalTimeRolesJSON ¶
func UnmarshalTimeRolesJSON(rolesJSON []byte) (roles []GuildSettingsTimeRolesRole)
type GuildVariables ¶
type GuildVariables struct {
*discord.Guild
MembersJoined int32
NumberLocale database.NumberLocale
}
type HorizontalAlignment ¶
type HorizontalAlignment string
const ( HorizontalAlignmentLeft HorizontalAlignment = "left" HorizontalAlignmentCenter HorizontalAlignment = "center" HorizontalAlignmentRight HorizontalAlignment = "right" )
type IPChecker ¶
type IPChecker interface {
CheckIP(ctx context.Context, ipaddress string, flags IPIntelFlags, oflags IPIntelOFlags) (response IPIntelResponse, err error)
}
type IPIntelError ¶
type IPIntelError struct {
Code float64 `json:"code"`
}
func (IPIntelError) Error ¶
func (e IPIntelError) Error() string
type IPIntelFlags ¶
type IPIntelFlags string
type IPIntelOFlags ¶
type IPIntelOFlags string
type IPIntelResponse ¶
type ImageAlignment ¶
type ImageAlignment int32
ENUM(left, center, right, topLeft, topCenter, topRight, bottomLeft, bottomCenter, bottomRight)
const ( // ImageAlignmentLeft is a ImageAlignment of type Left. ImageAlignmentLeft ImageAlignment = iota // ImageAlignmentCenter is a ImageAlignment of type Center. ImageAlignmentCenter // ImageAlignmentRight is a ImageAlignment of type Right. ImageAlignmentRight // ImageAlignmentTopLeft is a ImageAlignment of type TopLeft. ImageAlignmentTopLeft // ImageAlignmentTopCenter is a ImageAlignment of type TopCenter. ImageAlignmentTopCenter // ImageAlignmentTopRight is a ImageAlignment of type TopRight. ImageAlignmentTopRight // ImageAlignmentBottomLeft is a ImageAlignment of type BottomLeft. ImageAlignmentBottomLeft // ImageAlignmentBottomCenter is a ImageAlignment of type BottomCenter. ImageAlignmentBottomCenter // ImageAlignmentBottomRight is a ImageAlignment of type BottomRight. ImageAlignmentBottomRight )
func ParseImageAlignment ¶
func ParseImageAlignment(name string) (ImageAlignment, error)
ParseImageAlignment attempts to convert a string to a ImageAlignment.
func (*ImageAlignment) AppendText ¶
func (x *ImageAlignment) AppendText(b []byte) ([]byte, error)
AppendText appends the textual representation of itself to the end of b (allocating a larger slice if necessary) and returns the updated slice.
Implementations must not retain b, nor mutate any bytes within b[:len(b)].
func (ImageAlignment) IsValid ¶
func (x ImageAlignment) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (ImageAlignment) MarshalText ¶
func (x ImageAlignment) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (ImageAlignment) String ¶
func (x ImageAlignment) String() string
String implements the Stringer interface.
func (*ImageAlignment) UnmarshalText ¶
func (x *ImageAlignment) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type ImageFileType ¶
type ImageFileType int32
ENUM(unknown, image/png, image/jpeg, image/gif, image/webp)
const ( // ImageFileTypeUnknown is a ImageFileType of type Unknown. ImageFileTypeUnknown ImageFileType = iota // ImageFileTypeImagePng is a ImageFileType of type Image/Png. ImageFileTypeImagePng // ImageFileTypeImageJpeg is a ImageFileType of type Image/Jpeg. ImageFileTypeImageJpeg // ImageFileTypeImageGif is a ImageFileType of type Image/Gif. ImageFileTypeImageGif // ImageFileTypeImageWebp is a ImageFileType of type Image/Webp. ImageFileTypeImageWebp )
func ParseImageFileType ¶
func ParseImageFileType(name string) (ImageFileType, error)
ParseImageFileType attempts to convert a string to a ImageFileType.
func (*ImageFileType) AppendText ¶
func (x *ImageFileType) AppendText(b []byte) ([]byte, error)
AppendText appends the textual representation of itself to the end of b (allocating a larger slice if necessary) and returns the updated slice.
Implementations must not retain b, nor mutate any bytes within b[:len(b)].
func (ImageFileType) GetExtension ¶
func (i ImageFileType) GetExtension() string
func (ImageFileType) IsValid ¶
func (x ImageFileType) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (ImageFileType) MarshalText ¶
func (x ImageFileType) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (ImageFileType) String ¶
func (x ImageFileType) String() string
String implements the Stringer interface.
func (*ImageFileType) UnmarshalText ¶
func (x *ImageFileType) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type ImageProfileBorderType ¶
type ImageProfileBorderType int32
ENUM(circular, rounded, squared, hexagonal)
const ( // ImageProfileBorderTypeCircular is a ImageProfileBorderType of type Circular. ImageProfileBorderTypeCircular ImageProfileBorderType = iota // ImageProfileBorderTypeRounded is a ImageProfileBorderType of type Rounded. ImageProfileBorderTypeRounded // ImageProfileBorderTypeSquared is a ImageProfileBorderType of type Squared. ImageProfileBorderTypeSquared // ImageProfileBorderTypeHexagonal is a ImageProfileBorderType of type Hexagonal. ImageProfileBorderTypeHexagonal )
func ParseImageProfileBorderType ¶
func ParseImageProfileBorderType(name string) (ImageProfileBorderType, error)
ParseImageProfileBorderType attempts to convert a string to a ImageProfileBorderType.
func (*ImageProfileBorderType) AppendText ¶
func (x *ImageProfileBorderType) AppendText(b []byte) ([]byte, error)
AppendText appends the textual representation of itself to the end of b (allocating a larger slice if necessary) and returns the updated slice.
Implementations must not retain b, nor mutate any bytes within b[:len(b)].
func (ImageProfileBorderType) IsValid ¶
func (x ImageProfileBorderType) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (ImageProfileBorderType) MarshalText ¶
func (x ImageProfileBorderType) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (ImageProfileBorderType) String ¶
func (x ImageProfileBorderType) String() string
String implements the Stringer interface.
func (*ImageProfileBorderType) UnmarshalText ¶
func (x *ImageProfileBorderType) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type ImageTheme ¶
type ImageTheme int32
ENUM(default, vertical, card)
const ( // ImageThemeDefault is a ImageTheme of type Default. ImageThemeDefault ImageTheme = iota // ImageThemeVertical is a ImageTheme of type Vertical. ImageThemeVertical // ImageThemeCard is a ImageTheme of type Card. ImageThemeCard )
func ParseImageTheme ¶
func ParseImageTheme(name string) (ImageTheme, error)
ParseImageTheme attempts to convert a string to a ImageTheme.
func (*ImageTheme) AppendText ¶
func (x *ImageTheme) AppendText(b []byte) ([]byte, error)
AppendText appends the textual representation of itself to the end of b (allocating a larger slice if necessary) and returns the updated slice.
Implementations must not retain b, nor mutate any bytes within b[:len(b)].
func (ImageTheme) IsValid ¶
func (x ImageTheme) IsValid() bool
IsValid provides a quick way to determine if the typed value is part of the allowed enumerated values
func (ImageTheme) MarshalText ¶
func (x ImageTheme) MarshalText() ([]byte, error)
MarshalText implements the text marshaller method.
func (ImageTheme) String ¶
func (x ImageTheme) String() string
String implements the Stringer interface.
func (*ImageTheme) UnmarshalText ¶
func (x *ImageTheme) UnmarshalText(text []byte) error
UnmarshalText implements the text unmarshaller method.
type LRUIPChecker ¶
type LRUIPChecker struct {
// contains filtered or unexported fields
}
func NewLRUIPChecker ¶
func NewLRUIPChecker(maxSize int) *LRUIPChecker
NewLRUIPChecker creates a new LRU IP checker with the specified maximum cache size.
func (*LRUIPChecker) CheckIP ¶
func (c *LRUIPChecker) CheckIP(ctx context.Context, ipaddress string, flags IPIntelFlags, oflags IPIntelOFlags) (IPIntelResponse, error)
type LastChargeStatus ¶
type LastChargeStatus string
const ( LastChargeStatusDeclined LastChargeStatus = "Declined" LastChargeStatusPaid LastChargeStatus = "Paid" LastChargeStatusDeleted LastChargeStatus = "Deleted" LastChargeStatusPending LastChargeStatus = "Pending" LastChargeStatusRefunded LastChargeStatus = "Refunded" LastChargeStatusFraud LastChargeStatus = "Fraud" LastChargeStatusOther LastChargeStatus = "Other" )
type OnInvokeBorderwallCompletionFuncType ¶
type OnInvokeBorderwallCompletionFuncType func(eventCtx *sandwich.EventContext, member CustomEventInvokeBorderwallCompletionStructure) error
type OnInvokeBorderwallFuncType ¶
type OnInvokeBorderwallFuncType func(eventCtx *sandwich.EventContext, member CustomEventInvokeBorderwallStructure) error
type OnInvokeLeaverFuncType ¶
type OnInvokeLeaverFuncType func(eventCtx *sandwich.EventContext, member CustomEventInvokeLeaverStructure) error
type OnInvokeTempChannelsFuncType ¶
type OnInvokeTempChannelsFuncType func(eventCtx *sandwich.EventContext, member CustomEventInvokeTempChannelsStructure) error
type OnInvokeTempChannelsRemoveFuncType ¶
type OnInvokeTempChannelsRemoveFuncType func(eventCtx *sandwich.EventContext, member CustomEventInvokeTempChannelsRemoveStructure) error
type OnInvokeWelcomerFuncType ¶
type OnInvokeWelcomerFuncType func(eventCtx *sandwich.EventContext, member CustomEventInvokeWelcomerStructure) error
type PatreonMember ¶
type PatreonMember struct {
PatreonUserID discord.Snowflake `json:"patreon_user_id"`
EntitledTiers []PatreonTier `json:"active_tier"`
Attributes Attributes `json:"attributes"`
}
func GetAllPatreonMembers ¶
type PatreonTier ¶
type PatreonTier int64
const ( PatreonTierFree PatreonTier = 10503463 PatreonTierUnpublishedWelcomerDonator PatreonTier = 3975266 PatreonTierUnpublishedWelcomerPro1 PatreonTier = 3744919 PatreonTierUnpublishedWelcomerPro3 PatreonTier = 3744921 PatreonTierUnpublishedWelcomerPro5 PatreonTier = 3744926 PatreonTierWelcomerPro PatreonTier = 23606682 )
func (*PatreonTier) UnmarshalJSON ¶
func (s *PatreonTier) UnmarshalJSON(b []byte) error
type PatreonUser ¶
type PatreonUser struct {
ID discord.Snowflake `json:"id"`
Email string `json:"email"`
FullName string `json:"full_name"`
SocialConnections PatreonUser_SocialConnections `json:"social_connections"`
ThumbURL string `json:"thumb_url"`
}
func IdentifyPatreonMember ¶
func IdentifyPatreonMember(ctx context.Context, token string) (PatreonUser, error)
type PatreonUserOuter ¶
type PatreonUserOuter struct {
Data patreonUser `json:"data"`
}
type PatreonUser_Attributes ¶
type PatreonUser_Attributes struct {
Email string `json:"email"`
FullName string `json:"full_name"`
SocialConnections PatreonUser_SocialConnections `json:"social_connections"`
ThumbURL string `json:"thumb_url"`
}
type PatreonUser_Discord ¶
type PatreonUser_SocialConnections ¶
type PatreonUser_SocialConnections struct {
Discord PatreonUser_Discord `json:"discord"`
}
type PatronSocialConnections ¶
type PatronStatus ¶
type PatronStatus string
const ( PatreonStatusNeverPledged PatronStatus = "" PatreonStatusActive PatronStatus = "active_patron" PatreonStatusDeclined PatronStatus = "declined_patron" PatreonStatusFormer PatronStatus = "former_patron" )
type PaypalSale ¶
type PricingSKU ¶
type PricingSKU struct {
ID SKUName `json:"id"`
Name string `json:"name"`
Description string `json:"-"`
MembershipType database.MembershipType `json:"-"`
SoftDescriptor string `json:"-"` // This should be 13 characters or less.
MonthCount int `json:"month_count"`
Costs map[Currency]string `json:"costs"`
PatreonCheckoutID string `json:"patreon_checkout_id"`
IsRecurring bool `json:"is_recurring"`
PaypalSubscriptionID map[Currency]string `json:"paypal_subscription_id"`
}
type PushGuildScienceHandler ¶
type PushGuildScienceHandler struct {
sync.RWMutex
Buffer []database.CreateManyScienceGuildEventsParams
// contains filtered or unexported fields
}
var PushGuildScience *PushGuildScienceHandler
func NewPushGuildScienceHandler ¶
func NewPushGuildScienceHandler(limit int) *PushGuildScienceHandler
func (*PushGuildScienceHandler) Flush ¶
func (h *PushGuildScienceHandler) Flush(ctx context.Context)
func (*PushGuildScienceHandler) Push ¶
func (h *PushGuildScienceHandler) Push(ctx context.Context, guildID, userID discord.Snowflake, eventType database.ScienceGuildEventType, data any)
func (*PushGuildScienceHandler) PushRaw ¶
func (h *PushGuildScienceHandler) PushRaw(ctx context.Context, event database.CreateManyScienceGuildEventsParams)
type RecaptchaRequest ¶
type RecaptchaResponse ¶
type RedisDedupeProvider ¶
var DedupeProvider *RedisDedupeProvider
func NewRedisDedupeProvider ¶
func NewRedisDedupeProvider(client *redis.Client, logger *slog.Logger) *RedisDedupeProvider
func (*RedisDedupeProvider) Deduplicate ¶
type Relationships ¶
type Relationships struct {
CurrentlyEntitledTiers struct {
Data []struct {
ID PatreonTier `json:"id"`
} `json:"data"`
} `json:"currently_entitled_tiers"`
User struct {
Data struct {
ID discord.Snowflake `json:"id"`
} `json:"data"`
} `json:"user"`
}
type StubGuild ¶
type StubGuild struct {
Name string `json:"name"`
Icon string `json:"icon"`
Splash string `json:"splash"`
Banner string `json:"banner"`
ID discord.Snowflake `json:"id"`
Members int32 `json:"members"`
MembersJoined int32 `json:"members_joined"`
}
Guild represents a guild on discord.
type StubInvite ¶
type StubInvite struct {
ExpiresAt StubTime `json:"expires_at"`
CreatedAt StubTime `json:"created_at"`
Inviter StubUser `json:"inviter"`
ChannelID discord.Snowflake `json:"channel"`
Code string `json:"code"`
Uses int32 `json:"uses"`
MaxUses int32 `json:"max_uses"`
MaxAge int32 `json:"max_age"`
Temporary bool `json:"temporary"`
}
Invite represents the invite used on discord.
type StubUser ¶
type StubUser struct {
CreatedAt StubTime `json:"created_at"`
JoinedAt StubTime `json:"joined_at"`
Name string `json:"name"`
Username string `json:"username"`
Discriminator string `json:"discriminator"`
GlobalName string `json:"global_name"`
Mention string `json:"mention"`
Avatar string `json:"avatar"`
ID discord.Snowflake `json:"id"`
Bot bool `json:"bot"`
Pending bool `json:"pending"`
}
StubUser represents a user on discord.
type TimingEntry ¶
type TwilightProxy ¶
type TwilightProxy struct {
HTTP *http.Client
APIVersion string
URLHost string
URLScheme string
UserAgent string
Debug bool
}
TwilightProxy is a proxy that requests are sent through, instead of directly to discord that will handle distributed requests and ratelimit automatically. See more at: https://github.com/twilight-rs/http-proxy
func (*TwilightProxy) SetDebug ¶
func (tl *TwilightProxy) SetDebug(value bool)
type UserAgentSetterTransport ¶
type UserAgentSetterTransport struct {
UserAgent string
// contains filtered or unexported fields
}
func NewUserAgentSetterTransport ¶
func NewUserAgentSetterTransport(roundTripper http.RoundTripper, userAgent string) *UserAgentSetterTransport
NewUserAgentSetterTransport creates a new UserAgentSetterTransport.
type UserProvidedEmbed ¶
type VerticalAlignment ¶
type VerticalAlignment string
const ( VerticalAlignmentTop VerticalAlignment = "start" VerticalAlignmentCenter VerticalAlignment = "center" VerticalAlignmentBottom VerticalAlignment = "end" )
type WelcomerDatabaseConfigProvider ¶
type WelcomerDatabaseConfigProvider struct {
DefaultConfigProvider sandwich_daemon.ConfigProvider
}
func (*WelcomerDatabaseConfigProvider) GetConfig ¶
func (p *WelcomerDatabaseConfigProvider) GetConfig(ctx context.Context) (*sandwich_daemon.Configuration, error)
func (*WelcomerDatabaseConfigProvider) SaveConfig ¶
func (p *WelcomerDatabaseConfigProvider) SaveConfig(ctx context.Context, config *sandwich_daemon.Configuration) error
Not implemented, as the configuration is read-only in this context.
Source Files
¶
- accelerators.go
- audit_logging.go
- auth.go
- buttons.go
- comparison.go
- configuration.go
- constants.go
- context.go
- custom_bot.go
- custom_builder.go
- database_connector.go
- deduplication.go
- default_configuration.go
- embeds.go
- encryption.go
- errors.go
- events.go
- formatting.go
- globals.go
- guild_features.go
- guild_features_enum.go
- guild_science_push.go
- guild_science_structs.go
- image_generation.go
- image_generation_enum.go
- ipintel.go
- logger.go
- membership_service.go
- membership_service_discord.go
- membership_service_notifications.go
- membership_service_patreon.go
- membership_service_paypal.go
- onboarding.go
- patreon.go
- pricing.go
- recaptcha.go
- roles.go
- safe_url.go
- session.go
- timeroles.go
- timing.go
- ua-transport.go
- utils.go
- validation.go
- values.go