Documentation ¶
Index ¶
- Variables
- func CancelAddRole(ctx context.Context, guildID, userID, roleID int64) error
- func CancelRemoveRole(ctx context.Context, guildID, userID, roleID int64) error
- func CheckDiscordErrRetry(err error) bool
- func RegisterHandler(eventName string, dataFormat interface{}, handler HandlerFunc)
- func RegisterLegacyMigrater(eventName string, migrationHandler func(t time.Time, data string) error)
- func RegisterPlugin()
- func ScheduleAddRole(ctx context.Context, guildID, userID, roleID int64, when time.Time) error
- func ScheduleDeleteMessages(guildID, channelID int64, when time.Time, messages ...int64) error
- func ScheduleEvent(evtName string, guildID int64, runAt time.Time, data interface{}) error
- func ScheduleRemoveRole(ctx context.Context, guildID, userID, roleID int64, when time.Time) error
- func UpdateFlushedEvent(t time.Time, c radix.Client, evt *models.ScheduledEvent) error
- type AddRoleData
- type DeleteMessagesEvent
- type HandlerFunc
- type RegisteredHandler
- type RmoveRoleData
- type ScheduledEvents
- func (se *ScheduledEvents) LateBotInit()
- func (se *ScheduledEvents) MigrateLegacyEvents()
- func (p *ScheduledEvents) PluginInfo() *common.PluginInfo
- func (p *ScheduledEvents) RunBackgroundWorker()
- func (p *ScheduledEvents) SecondaryCleaner()
- func (p *ScheduledEvents) StopBackgroundWorker(wg *sync.WaitGroup)
- func (se *ScheduledEvents) StopBot(wg *sync.WaitGroup)
Constants ¶
This section is empty.
Variables ¶
View Source
var DBSchemas = []string{`
CREATE TABLE IF NOT EXISTS scheduled_events (
id BIGSERIAL PRIMARY KEY,
created_at TIMESTAMP WITH TIME ZONE NOT NULL,
triggers_at TIMESTAMP WITH TIME ZONE NOT NULL,
retry_on_error BOOLEAN NOT NULL,
guild_id BIGINT NOT NULL,
event_name TEXT NOT NULL,
data JSONB NOT NULL,
processed BOOL not null
);
`, `
CREATE INDEX IF NOT EXISTS scheduled_events_triggers_at_idx ON scheduled_events(triggers_at);
`, `
ALTER TABLE scheduled_events ADD COLUMN IF NOT EXISTS error TEXT
`,
}
View Source
var ErrBadPairLength = errors.NewPlain("ID - GuildID pair corrupted")
Functions ¶
func CancelRemoveRole ¶
func CheckDiscordErrRetry ¶
func RegisterHandler ¶
func RegisterHandler(eventName string, dataFormat interface{}, handler HandlerFunc)
RegisterHandler registers a handler for the scpecified event name dataFormat is optional and should not be a pointer, it should match the type you're passing into ScheduleEvent
func RegisterLegacyMigrater ¶
func RegisterLegacyMigrater(eventName string, migrationHandler func(t time.Time, data string) error)
RegisterHandler registers a handler for the scpecified event name dataFormat is optional and should not be a pointer, it should match the type you're passing into ScheduleEvent
func RegisterPlugin ¶
func RegisterPlugin()
func ScheduleAddRole ¶
func ScheduleDeleteMessages ¶
func ScheduleEvent ¶
func ScheduleRemoveRole ¶
func UpdateFlushedEvent ¶
func UpdateFlushedEvent(t time.Time, c radix.Client, evt *models.ScheduledEvent) error
UpdateFlushedEvent updates a already flushed event by either removing it if its above the treshold, or updating the score
Types ¶
type AddRoleData ¶
type DeleteMessagesEvent ¶
type HandlerFunc ¶
type HandlerFunc func(evt *models.ScheduledEvent, data interface{}) (retry bool, err error)
type RegisteredHandler ¶
type RegisteredHandler struct { EvtName string DataFormat interface{} Handler HandlerFunc }
type RmoveRoleData ¶
type ScheduledEvents ¶
type ScheduledEvents struct {
// contains filtered or unexported fields
}
func (*ScheduledEvents) LateBotInit ¶
func (se *ScheduledEvents) LateBotInit()
func (*ScheduledEvents) MigrateLegacyEvents ¶
func (se *ScheduledEvents) MigrateLegacyEvents()
func (*ScheduledEvents) PluginInfo ¶
func (p *ScheduledEvents) PluginInfo() *common.PluginInfo
func (*ScheduledEvents) RunBackgroundWorker ¶
func (p *ScheduledEvents) RunBackgroundWorker()
func (*ScheduledEvents) SecondaryCleaner ¶
func (p *ScheduledEvents) SecondaryCleaner()
func (*ScheduledEvents) StopBackgroundWorker ¶
func (p *ScheduledEvents) StopBackgroundWorker(wg *sync.WaitGroup)
func (*ScheduledEvents) StopBot ¶
func (se *ScheduledEvents) StopBot(wg *sync.WaitGroup)
Source Files ¶
Click to show internal directories.
Click to hide internal directories.