Documentation
¶
Index ¶
- Variables
- func Approve(ctx workflow.Context, event SlashCommandEvent) error
- func Clean(ctx workflow.Context, event SlashCommandEvent) error
- func Explain(ctx workflow.Context, event SlashCommandEvent) error
- func Follow(ctx workflow.Context, event SlashCommandEvent) error
- func FreezeTurns(ctx workflow.Context, event SlashCommandEvent) error
- func Help(ctx workflow.Context, event SlashCommandEvent) error
- func Invite(ctx workflow.Context, event SlashCommandEvent) error
- func MyTurn(ctx workflow.Context, event SlashCommandEvent) error
- func NotMyTurn(ctx workflow.Context, event SlashCommandEvent) error
- func Nudge(ctx workflow.Context, event SlashCommandEvent, imagesHTTPServer string) error
- func NudgeImageURL(ctx workflow.Context, httpServer string) string
- func PostEphemeralError(ctx workflow.Context, event SlashCommandEvent, msg string)
- func Reminders(ctx workflow.Context, event SlashCommandEvent, alertsChannel string) error
- func SelfStatus(ctx workflow.Context, event SlashCommandEvent, showDrafts bool, ...) error
- func SetReminder(ctx workflow.Context, event SlashCommandEvent, t string, quiet bool, ...) error
- func StatusOfOthers(ctx workflow.Context, event SlashCommandEvent, showDrafts bool, ...) error
- func Unapprove(ctx workflow.Context, event SlashCommandEvent) (err error)
- func Unfollow(ctx workflow.Context, event SlashCommandEvent) error
- func UnfreezeTurns(ctx workflow.Context, event SlashCommandEvent) error
- func UserDetails(ctx workflow.Context, event SlashCommandEvent, userID string) (data.User, bool, error)
- func WhoseTurn(ctx workflow.Context, event SlashCommandEvent) error
- type SlashCommandEvent
Constants ¶
This section is empty.
Variables ¶
var ( // PullRequestURLPattern is a regular expression that supports PR and comment URLs in Bitbucket and GitHub: // 1. Hostname (e.g., "bitbucket.org", "github.com") // 2. Bitbucket workspace / GitHub owner // 3. Repository // 4. Partial PR path ("" in GitHub / "-requests" in Bitbucket) // 5. PR number // 6. Optional suffix for comments // 7. Numeric comment ID (within 6, if it's not empty) PullRequestURLPattern = regexp.MustCompile(`https://([^/]+)/([^/]+)/([^/]+)/pull(-requests)?/(\d+)([^\s\d]+(\d+))?`) )
var RemindersSyntax = regexp.MustCompile(`^reminders?(\s+at)?\s+([0-9:]+)\s*(am|pm|a|p)?`)
RemindersSyntax is the regular expression that parses the reminders slash command, to set the time and timezone for the user's daily reminders.
/revchat reminder[s] [at] <time in 12h or 24h format> [am|pm|a|p]
Functions ¶
func FreezeTurns ¶
func FreezeTurns(ctx workflow.Context, event SlashCommandEvent) error
func Nudge ¶
func Nudge(ctx workflow.Context, event SlashCommandEvent, imagesHTTPServer string) error
func NudgeImageURL ¶ added in v1.4.0
NudgeImageURL selects a random nudge image and returns its full URL. This function uses workflow.SideEffect to enforce determinism.
func PostEphemeralError ¶
func PostEphemeralError(ctx workflow.Context, event SlashCommandEvent, msg string)
func Reminders ¶
func Reminders(ctx workflow.Context, event SlashCommandEvent, alertsChannel string) error
func SelfStatus ¶ added in v1.4.2
func SelfStatus(ctx workflow.Context, event SlashCommandEvent, showDrafts bool, alertsChannel string) error
SelfStatus is similar to StatusOfOthers but lists all the PRs that require the calling user's attention, i.e. PRs where it's their turn to review or respond. The user must be opted-in to use this command.
func SetReminder ¶
func StatusOfOthers ¶ added in v1.4.2
func StatusOfOthers(ctx workflow.Context, event SlashCommandEvent, showDrafts bool, thrippyID, alertsChannel string) error
StatusOfOthers is similar to SelfStatus but lists all the PRs associated with the given users and/or groups. This is the only command that doesn't require the calling user to be opted-in.
func UnfreezeTurns ¶
func UnfreezeTurns(ctx workflow.Context, event SlashCommandEvent) error
func UserDetails ¶
func UserDetails(ctx workflow.Context, event SlashCommandEvent, userID string) (data.User, bool, error)
UserDetails retrieves the user details from internal data based on their Slack ID, and (based on that) whether they are opted-in or not.
Types ¶
type SlashCommandEvent ¶
type SlashCommandEvent struct {
APIAppID string `json:"api_app_id"`
IsEnterpriseInstall string `json:"is_enterprise_install"`
EnterpriseID string `json:"enterprise_id,omitempty"`
EnterpriseName string `json:"enterprise_name,omitempty"`
TeamID string `json:"team_id"`
TeamDomain string `json:"team_domain"`
ChannelID string `json:"channel_id"`
ChannelName string `json:"channel_name"`
UserID string `json:"user_id"`
UserName string `json:"user_name"`
Command string `json:"command"`
Text string `json:"text"`
ResponseURL string `json:"response_url"`
TriggerID string `json:"trigger_id"`
}
https://docs.slack.dev/interactivity/implementing-slash-commands/#app_command_handling https://docs.slack.dev/apis/events-api/using-socket-mode#command