Documentation
¶
Overview ¶
Package slack provides the Slack implementation of the communication interface.
Index ¶
- Constants
- func AppMentionEventToIncomingMessage(event *slackevents.AppMentionEvent) models.IncomingMessage
- func MessageEventToIncomingMessage(event *slackevents.MessageEvent) models.IncomingMessage
- type Assistant
- func (a *Assistant) AddChannel(channelID string, dbLabInstance *dblab.Instance)
- func (a *Assistant) CheckIdleSessions(ctx context.Context)
- func (a *Assistant) Deregister(_ context.Context) error
- func (a *Assistant) DumpSessions()
- func (a *Assistant) Init() error
- func (a *Assistant) Register(_ context.Context) error
- func (a *Assistant) RestoreSessions(ctx context.Context) error
- type MessageValidator
- type Messenger
- func (m *Messenger) AddArtifact(title, explainResult, channelID, messageID string) (string, error)
- func (m *Messenger) DownloadArtifact(privateURL string) ([]byte, error)
- func (m *Messenger) Fail(message *models.Message, text string) error
- func (m *Messenger) OK(message *models.Message) error
- func (m *Messenger) Publish(message *models.Message) error
- func (m *Messenger) UpdateStatus(message *models.Message, status models.MessageStatus) error
- func (m *Messenger) UpdateText(message *models.Message) error
- type MessengerConfig
- type UserInformer
Constants ¶
const ( ReactionRunning = "hourglass_flowing_sand" ReactionError = "x" ReactionOK = "white_check_mark" )
Bot reactions.
const CommunicationType = "slack"
CommunicationType defines a workspace type.
Variables ¶
This section is empty.
Functions ¶
func AppMentionEventToIncomingMessage ¶
func AppMentionEventToIncomingMessage(event *slackevents.AppMentionEvent) models.IncomingMessage
AppMentionEventToIncomingMessage converts a Slack application mention event to the standard incoming message.
func MessageEventToIncomingMessage ¶
func MessageEventToIncomingMessage(event *slackevents.MessageEvent) models.IncomingMessage
MessageEventToIncomingMessage converts a Slack message event to the standard incoming message.
Types ¶
type Assistant ¶
type Assistant struct {
// contains filtered or unexported fields
}
Assistant provides a service for interaction with a communication channel.
func NewAssistant ¶
func NewAssistant(cfg *config.Credentials, appCfg *config.Config, handlerPrefix string, pack *features.Pack, platformClient *platform.Client, sessionStorage storage.SessionStorage) *Assistant
NewAssistant returns a new assistant service.
func (*Assistant) AddChannel ¶
AddChannel sets a message processor for a specific channel.
func (*Assistant) CheckIdleSessions ¶
CheckIdleSessions check the running user sessions for idleness.
func (*Assistant) Deregister ¶
Deregister deregisters the assistant service.
func (*Assistant) DumpSessions ¶
func (a *Assistant) DumpSessions()
DumpSessions collects user's data from every message processor to sessionStorage.
type MessageValidator ¶
type MessageValidator struct { }
MessageValidator validates incoming messages.
func (MessageValidator) Validate ¶
func (mv MessageValidator) Validate(incomingMessage *models.IncomingMessage) error
Validate validates an incoming message.
type Messenger ¶
type Messenger struct {
// contains filtered or unexported fields
}
Messenger provides a communication via Slack API.
func NewMessenger ¶
func NewMessenger(api *slack.Client, cfg *MessengerConfig) *Messenger
NewMessenger creates a new Slack messenger service.
func (*Messenger) AddArtifact ¶
AddArtifact uploads artifacts to a communication channel.
func (*Messenger) DownloadArtifact ¶
DownloadArtifact downloads snippets from a communication channel.
func (*Messenger) UpdateStatus ¶
UpdateStatus updates message reactions.
type MessengerConfig ¶
type MessengerConfig struct {
AccessToken string
}
MessengerConfig defines a slack configuration parameters.
type UserInformer ¶
type UserInformer struct {
// contains filtered or unexported fields
}
UserInformer provides a service for getting user info.
func NewUserInformer ¶
func NewUserInformer(api *slack.Client) *UserInformer
NewUserInformer creates a new UserInformer service.
func (*UserInformer) GetUserInfo ¶
func (m *UserInformer) GetUserInfo(userID string) (models.UserInfo, error)
GetUserInfo retrieves user info by ID.