bot

package
v0.15.21 Latest Latest
Warning

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

Go to latest
Published: Jul 19, 2022 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewBot

func NewBot(slackClient SlackClient, opts Opts) http.Handler

NewBot - create a new bot handler

Types

type Opts

type Opts struct {
	// UserAccessToken - the Slack user access token
	UserAccessToken string
	// SigningSecret - the signing secret from the Slack app config
	SigningSecret string
	// BroadcastChannelID - the ID of the Slack channel the bot will broadcast in
	BroadcastChannelID string
	// AdminGroupID - the ID of the user group that will have admin rights to interact with the bot
	AdminGroupID string
	// IncidentDocTemplateURL - the URL of the incident document template
	IncidentDocTemplateURL string
	// IncidentEnvs - the environments that could possibly be affected
	IncidentEnvs string
	// IncidentRegions - the regions that could possibly be affected
	IncidentRegions string
	// IncidentSeverityLevels - the possible severity levels of an incident
	IncidentSeverityLevels string
	// IncidentImpactLevels - the possible impact levels of an incident
	IncidentImpactLevels string
	// Localizer - the localizer to use for the set of language preferences
	Localizer *i18n.Localizer
}

type SlackClient

type SlackClient interface {
	SendMessageContext(ctx context.Context, channelID string, options ...slack.MsgOption) (_channel, _timestamp, _text string, err error)
	GetUserGroupMembersContext(ctx context.Context, userGroup string) ([]string, error)
	OpenViewContext(ctx context.Context, triggerID string, view slack.ModalViewRequest) (*slack.ViewResponse, error)
	UpdateViewContext(ctx context.Context, view slack.ModalViewRequest, externalID, hash, viewID string) (*slack.ViewResponse, error)
	CreateConversationContext(ctx context.Context, channelName string, isPrivate bool) (*slack.Channel, error)
	GetConversationInfoContext(ctx context.Context, channelID string, includeLocale bool) (*slack.Channel, error)
	ArchiveConversationContext(ctx context.Context, channelID string) error
	SetPurposeOfConversationContext(ctx context.Context, channelID, purpose string) (*slack.Channel, error)
	SetTopicOfConversationContext(ctx context.Context, channelID, topic string) (*slack.Channel, error)
	InviteUsersToConversationContext(ctx context.Context, channelID string, users ...string) (*slack.Channel, error)
	AddChannelReminder(channelID string, text string, time string) (*slack.Reminder, error)
	GetUserInfoContext(ctx context.Context, user string) (*slack.User, error)
	AuthTestContext(ctx context.Context) (*slack.AuthTestResponse, error)
	GetConversationsForUserContext(ctx context.Context, params *slack.GetConversationsForUserParameters) ([]slack.Channel, string, error)
}

SlackClient - a partial interface to slack.Client

Jump to

Keyboard shortcuts

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