Documentation
¶
Overview ¶
templ: version: v0.3.1001
Index ¶
- type Config
- type DiscordUserInfo
- type GuildMemberInfo
- type LoginCompleteFunc
- type Module
- func (m *Module) AttachRoutes(router *engine.Router)
- func (m *Module) AttachWorkers(mgr *engine.ProcMgr)
- func (m *Module) ConfigSpec() config.Spec
- func (m *Module) GetItem(ctx context.Context) (item *syncItem, err error)
- func (m *Module) IsLoginEnabled(ctx context.Context) bool
- func (m *Module) ProcessItem(ctx context.Context, item *syncItem) error
- func (m *Module) SetConfigLoader(store *config.Store)
- func (m *Module) SetLoginCompleter(f LoginCompleteFunc)
- func (m *Module) SetSignupConfirm(f SignupConfirmFunc)
- func (m *Module) UpdateItem(ctx context.Context, item *syncItem, success bool) error
- type SignupConfirmFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// OAuth2 Configuration
ClientID string `json:"client_id" config:"label=Client ID,section=oauth,help=The Application ID from Discord Developer Portal."`
ClientSecret string `json:"client_secret" config:"label=Client Secret,secret,section=oauth,help=Keep this confidential."`
// Bot Configuration
BotToken string `json:"bot_token" config:"label=Bot Token,secret,section=bot"`
GuildID string `` /* 166-byte string literal not displayed */
RoleID string `` /* 176-byte string literal not displayed */
// Sync Settings
SyncIntervalHours int `` /* 199-byte string literal not displayed */
}
Config holds Discord-related configuration.
type DiscordUserInfo ¶
type GuildMemberInfo ¶
type LoginCompleteFunc ¶
type LoginCompleteFunc func(w http.ResponseWriter, r *http.Request, memberID int64, callbackURI string)
LoginCompleteFunc is called by the discord module to finish a login flow. It receives the member ID and the callback URI to redirect to after login.
type Module ¶
type Module struct {
// contains filtered or unexported fields
}
func New ¶
func New(db *sql.DB, self *url.URL, iss *engine.TokenIssuer, eventLogger *engine.EventLogger) *Module
func (*Module) AttachRoutes ¶
func (*Module) AttachWorkers ¶
func (*Module) ConfigSpec ¶
ConfigSpec returns the Discord configuration specification.
func (*Module) IsLoginEnabled ¶
IsLoginEnabled reports whether Discord OAuth login is available.
func (*Module) ProcessItem ¶
func (*Module) SetConfigLoader ¶
SetConfigLoader sets the typed config loader for this module.
func (*Module) SetLoginCompleter ¶
func (m *Module) SetLoginCompleter(f LoginCompleteFunc)
SetLoginCompleter configures the function used to complete Discord-based logins. This must be called before routes are attached.
func (*Module) SetSignupConfirm ¶
func (m *Module) SetSignupConfirm(f SignupConfirmFunc)
SetSignupConfirm configures the function used to show the signup confirmation page. This must be called before routes are attached.
type SignupConfirmFunc ¶
type SignupConfirmFunc func(w http.ResponseWriter, r *http.Request, email, provider, callbackURI string)
SignupConfirmFunc is called when no account exists for the user's email. It renders a confirmation page asking the user to confirm account creation.