Documentation ¶
Index ¶
- func EmailSentFollowupData() *api.InteractionResponseData
- func ErrorResponse(err error) *api.InteractionResponse
- func ErrorResponseData(err error) *api.InteractionResponseData
- func InternalErrorResponse() *api.InteractionResponse
- func InternalErrorResponseData() *api.InteractionResponseData
- func SendConfirmationEmail(ctx context.Context, smtpVerifier *verifyemail.SMTPVerifier, c *Client, ...)
- type Client
- func (c *Client) Context() context.Context
- func (c *Client) FollowUp(ev *discord.InteractionEvent, data *api.InteractionResponseData)
- func (c *Client) FollowUpInternalError(ev *discord.InteractionEvent, err error)
- func (c *Client) LogErr(guildID discord.GuildID, err error)
- func (c *Client) PrivateWarning(ev *discord.InteractionEvent, sendErr error)
- type ConfirmationEmailScheduler
- type Handler
- type Opts
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EmailSentFollowupData ¶
func EmailSentFollowupData() *api.InteractionResponseData
EmailSentFollowupData creates an *api.InteractionResponseData to be used as a reply to notify the user that the email has been delivered.
func ErrorResponse ¶
func ErrorResponse(err error) *api.InteractionResponse
ErrorResponse creates a new erroneous interaction response.
func ErrorResponseData ¶
func ErrorResponseData(err error) *api.InteractionResponseData
ErrorResponseData creates a new erroneous interaction response data.
func InternalErrorResponse ¶
func InternalErrorResponse() *api.InteractionResponse
InternalErrorResponse is used in case of confidential errors.
func InternalErrorResponseData ¶
func InternalErrorResponseData() *api.InteractionResponseData
InternalErrorResponseData is used in case of confidential errors.
func SendConfirmationEmail ¶
func SendConfirmationEmail( ctx context.Context, smtpVerifier *verifyemail.SMTPVerifier, c *Client, ev *discord.InteractionEvent, m acmregister.Member)
SendConfirmationEmail send a confirmation email then follows up to the interaction event.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client wraps around state.State for some common functionalities.
func (*Client) FollowUp ¶
func (c *Client) FollowUp(ev *discord.InteractionEvent, data *api.InteractionResponseData)
FollowUp sends a followup response.
func (*Client) FollowUpInternalError ¶
func (c *Client) FollowUpInternalError(ev *discord.InteractionEvent, err error)
FollowUpInternalError logs the error then follows up with an internal error message.
func (*Client) LogErr ¶
LogErr logs the given error to stdout. It attaches guild information if possible.
func (*Client) PrivateWarning ¶
func (c *Client) PrivateWarning(ev *discord.InteractionEvent, sendErr error)
PrivateWarning is like PrivateErr, except the user does not get a reply back saying things have gone wrong. Use this if we don't intend to return after the error.
type ConfirmationEmailScheduler ¶
type ConfirmationEmailScheduler interface { // ScheduleConfirmationEmail asynchronously schedules an email to be sent in // the background. It has no error reporting; the implementation is expected // to use the InteractionEvent to send a reply. ScheduleConfirmationEmail(c *Client, ev *discord.InteractionEvent, m acmregister.Member) error // Close cancels any scheduled jobs, if any. Close() error }
ConfirmationEmailScheduler schedules a confirmation email to be sent and a follow-up to be notified to the user. To send this specific follow-up, use Handler.EmailSentFollowup.
func NewAsyncConfirmationEmailSender ¶
func NewAsyncConfirmationEmailSender(smtpVerifier *verifyemail.SMTPVerifier) ConfirmationEmailScheduler
NewAsyncConfirmationEmailSender creates a new ConfirmationEmailScheduler. Its job is to send an email over SMTP and deliver a response within a goroutine.
type Handler ¶
type Handler struct { Client // contains filtered or unexported fields }
func NewHandler ¶
NewHandler creates a new Handler instance bound to the given State.
func (*Handler) HandleInteraction ¶
func (h *Handler) HandleInteraction(ev *discord.InteractionEvent) *api.InteractionResponse
func (*Handler) OverwriteCommands ¶
OverwriteCommands overwrites the commands to the ones defined in Commands.
type Opts ¶
type Opts struct { Store acmregister.Store PINStore verifyemail.PINStore // optional EmailHosts acmregister.EmailHostsVerifier // optional EmailVerifier acmregister.EmailVerifier // optional EmailScheduler ConfirmationEmailScheduler // optional }