commands

package
v1.9.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2026 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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+))?`)
)
View Source
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 Approve

func Approve(ctx workflow.Context, event SlashCommandEvent) error

func Clean

func Clean(ctx workflow.Context, event SlashCommandEvent) error

func Explain

func Explain(ctx workflow.Context, event SlashCommandEvent) error

func Follow

func Follow(ctx workflow.Context, event SlashCommandEvent) error

func FreezeTurns

func FreezeTurns(ctx workflow.Context, event SlashCommandEvent) error

func Help

func Help(ctx workflow.Context, event SlashCommandEvent) error

func Invite

func Invite(ctx workflow.Context, event SlashCommandEvent) error

func MyTurn

func MyTurn(ctx workflow.Context, event SlashCommandEvent) error

func NotMyTurn

func NotMyTurn(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

func NudgeImageURL(ctx workflow.Context, httpServer string) string

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 SetReminder(ctx workflow.Context, event SlashCommandEvent, t string, quiet bool, alertsChannel string) error

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 Unapprove

func Unapprove(ctx workflow.Context, event SlashCommandEvent) (err error)

func Unfollow

func Unfollow(ctx workflow.Context, event SlashCommandEvent) error

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.

func WhoseTurn

func WhoseTurn(ctx workflow.Context, event SlashCommandEvent) error

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL