Skip to content

Instantly share code, notes, and snippets.

@proclaim
Created October 19, 2020 10:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save proclaim/38bb1b7624625a4edb8da4b0ac9f8325 to your computer and use it in GitHub Desktop.
Save proclaim/38bb1b7624625a4edb8da4b0ac9f8325 to your computer and use it in GitHub Desktop.
package service
import (
"github.com/slack-go/slack"
)
func (s *SlackService) PostMessage(channel string, attachment slack.Attachment) (string, string, error) {
// ... your implementation here
return s.api.PostMessage(
channel,
slack.MsgOptionAttachments(attachment),
slack.MsgOptionAsUser(true),
)
}
package service
import "github.com/slack-go/slack"
type SlackAPI interface {
PostMessage(channelID string, options ...slack.MsgOption) (string, string, error)
}
type SlackService struct {
api SlackAPI
}
func NewSlackService(api SlackAPI) *SlackService {
return &SlackService{
api: api,
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment