Documentation ¶
Index ¶
- func JSON(ref interface{}) string
- func JSONBlock(ref interface{}) string
- type Bot
- func (b *Bot) DM(userID string, post *model.Post) error
- func (b *Bot) Debugf(format string, args ...interface{})
- func (b *Bot) EphemeralPost(userID, channelID string, post *model.Post)
- func (b *Bot) EphemeralPostWithAttachments(userID, channelID, postID string, attachments []*model.SlackAttachment, ...)
- func (b *Bot) Errorf(format string, args ...interface{})
- func (b *Bot) Infof(format string, args ...interface{})
- func (b *Bot) IsFromPoster(post *model.Post) bool
- func (b *Bot) NotifyAdmins(messageType, authorUserID string, isTeamEdition bool) error
- func (b *Bot) Post(post *model.Post) error
- func (b *Bot) PostCustomMessageWithAttachments(channelID, customType string, attachments []*model.SlackAttachment, ...) (*model.Post, error)
- func (b *Bot) PostMessage(channelID, format string, args ...interface{}) (*model.Post, error)
- func (b *Bot) PostMessageToThread(rootPostID string, post *model.Post) error
- func (b *Bot) PostMessageWithAttachments(channelID string, attachments []*model.SlackAttachment, format string, ...) (*model.Post, error)
- func (b *Bot) PromptForFeedback(userID string) error
- func (b *Bot) PublishWebsocketEventToChannel(event string, payload interface{}, channelID string)
- func (b *Bot) PublishWebsocketEventToTeam(event string, payload interface{}, teamID string)
- func (b *Bot) PublishWebsocketEventToUser(event string, payload interface{}, userID string)
- func (b *Bot) SystemEphemeralPost(userID, channelID string, post *model.Post)
- func (b *Bot) Timed() Logger
- func (b *Bot) Warnf(format string, args ...interface{})
- func (b *Bot) With(logContext LogContext) Logger
- type LogContext
- type Logger
- type NilLogger
- func (l *NilLogger) Debugf(format string, args ...interface{})
- func (l *NilLogger) Errorf(format string, args ...interface{})
- func (l *NilLogger) Infof(format string, args ...interface{})
- func (l *NilLogger) Timed() Logger
- func (l *NilLogger) Warnf(format string, args ...interface{})
- func (l *NilLogger) With(logContext LogContext) Logger
- type Poster
- type Telemetry
- type TestLogger
- func (l *TestLogger) Debugf(format string, args ...interface{})
- func (l *TestLogger) Errorf(format string, args ...interface{})
- func (l *TestLogger) Infof(format string, args ...interface{})
- func (l *TestLogger) Timed() Logger
- func (l *TestLogger) Warnf(format string, args ...interface{})
- func (l *TestLogger) With(logContext LogContext) Logger
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Bot ¶
type Bot struct {
// contains filtered or unexported fields
}
Bot stores the information for the plugin configuration, and implements the Poster and Logger interfaces.
func New ¶
func New(api *pluginapi.Client, botUserID string, configService config.Service, telemetry Telemetry) *Bot
New creates a new bot poster/logger.
func (*Bot) EphemeralPost ¶
EphemeralPost sends an ephemeral message to a user
func (*Bot) EphemeralPostWithAttachments ¶
func (b *Bot) EphemeralPostWithAttachments(userID, channelID, postID string, attachments []*model.SlackAttachment, format string, args ...interface{})
EphemeralPostWithAttachments sends an ephemeral message to a user with Slack attachments.
func (*Bot) NotifyAdmins ¶
func (*Bot) Post ¶
Post posts a custom post. The Message and ChannelId fields should be provided in the specified post
func (*Bot) PostCustomMessageWithAttachments ¶
func (*Bot) PostMessage ¶
PostMessage posts a message to a specified channel.
func (*Bot) PostMessageToThread ¶
PostMessageToThread posts a message to a specified thread identified by rootPostID. If the rootPostID is blank, or the rootPost is deleted, it will create a standalone post. The overwritten post's RootID will be the correct rootID (save that if you want to continue the thread).
func (*Bot) PostMessageWithAttachments ¶
func (b *Bot) PostMessageWithAttachments(channelID string, attachments []*model.SlackAttachment, format string, args ...interface{}) (*model.Post, error)
PostMessageWithAttachments posts a message with slack attachments to channelID. Returns the post id if posting was successful. Often used to include post actions.
func (*Bot) PromptForFeedback ¶
func (*Bot) PublishWebsocketEventToChannel ¶
PublishWebsocketEventToChannel sends a websocket event with payload to channelID
func (*Bot) PublishWebsocketEventToTeam ¶
PublishWebsocketEventToTeam sends a websocket event with payload to teamID
func (*Bot) PublishWebsocketEventToUser ¶
PublishWebsocketEventToUser sends a websocket event with payload to userID
func (*Bot) SystemEphemeralPost ¶ added in v1.26.0
SystemEphemeralPost sends an ephemeral message to a user authored by the System
type Logger ¶
type Logger interface { With(LogContext) Logger Timed() Logger Debugf(format string, args ...interface{}) Errorf(format string, args ...interface{}) Infof(format string, args ...interface{}) Warnf(format string, args ...interface{}) }
Logger interface - a logging system that will tee logs to a DM channel.
type Poster ¶
type Poster interface { // Post posts a custom post, which should provide the Message and ChannelId fields Post(post *model.Post) error // PostMessage posts a simple message to channelID. Returns the post id if posting was successful. PostMessage(channelID, format string, args ...interface{}) (*model.Post, error) // PostMessageToThread posts a message to a specified channel and thread identified by rootPostID. // If the rootPostID is blank, or the rootPost is deleted, it will create a standalone post. The // returned post's RootID (or ID, if there was no root post) should be used as the rootID for // future use (i.e., save that if you want to continue the thread). PostMessageToThread(rootPostID string, post *model.Post) error // PostMessageWithAttachments posts a message with slack attachments to channelID. Returns the post id if // posting was successful. Often used to include post actions. PostMessageWithAttachments(channelID string, attachments []*model.SlackAttachment, format string, args ...interface{}) (*model.Post, error) // PostCustomMessageWithAttachments posts a custom message with the specified type. Falling back to attachments for mobile. PostCustomMessageWithAttachments(channelID, customType string, attachments []*model.SlackAttachment, format string, args ...interface{}) (*model.Post, error) // DM posts a DM from the plugin bot to the specified user DM(userID string, post *model.Post) error // EphemeralPost sends an ephemeral message to a user. EphemeralPost(userID, channelID string, post *model.Post) // SystemEphemeralPost sends an ephemeral message to a user authored by the System. SystemEphemeralPost(userID, channelID string, post *model.Post) // EphemeralPostWithAttachments sends an ephemeral message to a user with Slack attachments. EphemeralPostWithAttachments(userID, channelID, rootPostID string, attachments []*model.SlackAttachment, format string, args ...interface{}) // PublishWebsocketEventToTeam sends a websocket event with payload to teamID. PublishWebsocketEventToTeam(event string, payload interface{}, teamID string) // PublishWebsocketEventToChannel sends a websocket event with payload to channelID. PublishWebsocketEventToChannel(event string, payload interface{}, channelID string) // PublishWebsocketEventToUser sends a websocket event with payload to userID. PublishWebsocketEventToUser(event string, payload interface{}, userID string) // NotifyAdmins sends a DM with the message to each admins NotifyAdmins(message, authorUserID string, isTeamEdition bool) error // PromptForFeedback sends a DM as the feedbackbot to the given user, prompting for product feedback. PromptForFeedback(userID string) error // IsFromPoster returns whether the provided post was sent by this poster IsFromPoster(post *model.Post) bool }
Poster interface - a small subset of the plugin posting API.
type TestLogger ¶
TestLogger test logger.
func (*TestLogger) Debugf ¶
func (l *TestLogger) Debugf(format string, args ...interface{})
Debugf .
func (*TestLogger) Errorf ¶
func (l *TestLogger) Errorf(format string, args ...interface{})
Errorf .