Versions in this module Expand all Collapse all v1 v1.24.19 Mar 7, 2021 Changes in this version + type NewPremiumGuildListener interface + OnNewPremiumGuild func(guildID int64) error + type RemovedPremiumGuildListener interface + OnRemovedPremiumGuild func(guildID int64) error v1.20.6 Sep 3, 2019 Changes in this version + const NormalStateMaxMessageAge + const NormalStateMaxMessages + const PremiumStateMaxMessageAge + const PremiumStateMaxMessags + const RedisKeyPremiumGuildLastActive + const RedisKeyPremiumGuilds + const RedisKeyPremiumGuildsTmp + var DBSchemas = []string + var ErrCodeCollision = errors.New("Code collision") + var ErrCodeExpired = errors.New("Code expired") + var ErrCodeNotFound = errors.New("Code not found") + var ErrGuildAlreadyPremium = errors.New("guild already assigned premium from another slot") + var ErrSlotNotFound = errors.New("premium slot not found") + var PremiumSources []PremiumSource + func AllGuildsOncePremium() (map[int64]time.Time, error) + func AttachSlotToGuild(ctx context.Context, slotID int64, userID int64, guildID int64) error + func ContextPremium(ctx context.Context) bool + func CreatePremiumSlot(ctx context.Context, exec boil.ContextExecutor, userID int64, ...) (*models.PremiumSlot, error) + func DetachSlotFromGuild(ctx context.Context, slotID int64, userID int64) error + func GenerateCode(ctx context.Context, message string, duration time.Duration) (*models.PremiumCode, error) + func HandleGetPremiumMainPage(w http.ResponseWriter, r *http.Request) (tmpl web.TemplateData, err error) + func HandlePostLookupCode(w http.ResponseWriter, r *http.Request) (tmpl web.TemplateData, err error) + func HandlePostRedeemCode(w http.ResponseWriter, r *http.Request) (tmpl web.TemplateData, err error) + func HandlePostUpdateSlot(w http.ResponseWriter, r *http.Request) (tmpl web.TemplateData, err error) + func IsGuildPremium(guildID int64) (bool, error) + func IsGuildPremiumCached(guildID int64) (bool, error) + func LookupCode(ctx context.Context, code string) (*models.PremiumCode, error) + func PremiumGuildMW(inner http.Handler) http.Handler + func PremiumProvidedBy(guildID int64) (int64, error) + func RedeemCode(ctx context.Context, code string, userID int64) error + func RegisterPlugin() + func RegisterPremiumSource(source PremiumSource) + func RemovePremiumSlots(ctx context.Context, exec boil.ContextExecutor, userID int64, ...) error + func SlotDurationLeft(slot *models.PremiumSlot) (duration time.Duration) + func SlotExpired(ctx context.Context, slot *models.PremiumSlot) error + func TryRetryGenerateCode(ctx context.Context, message string, duration time.Duration) (*models.PremiumCode, error) + func UserPremiumSlots(ctx context.Context, userID int64) (slots []*models.PremiumSlot, err error) + type CacheKey int + const CacheKeyIsPremium + type CodePremiumSource struct + func (ps *CodePremiumSource) Init() + func (ps *CodePremiumSource) Names() (human string, idname string) + type CtxKey int + var CtxKeyIsPremium CtxKey = 1 + type Plugin struct + func (p *Plugin) AddCommands() + func (p *Plugin) BotInit() + func (p *Plugin) InitWeb() + func (p *Plugin) LoadServerHomeWidget(w http.ResponseWriter, r *http.Request) (web.TemplateData, error) + func (p *Plugin) MessageLimits(cs *dstate.ChannelState) (maxMessages int, maxMessageAge time.Duration) + func (p *Plugin) PluginInfo() *common.PluginInfo + func (p *Plugin) RunBackgroundWorker() + func (p *Plugin) ServerHomeWidgetOrder() int + func (p *Plugin) StopBackgroundWorker(wg *sync.WaitGroup) + type PremiumSource interface + Init func() + Names func() (human string, idname string) + func FindSource(sourceID string) PremiumSource + type UpdateData struct + GuildID int64