Skip to content

Commit

Permalink
Made the connections to the slack App/Bot public (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
robiball authored and adampointer committed Sep 10, 2018
1 parent 71fe324 commit 2d6486b
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions wrapper/slack.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ type SlackWrapper interface {

// Slack is a wrapper around the Slack App and RTM APIs
type Slack struct {
app *slack.Client
bot *slackbot.Bot
App *slack.Client
Bot *slackbot.Bot
}

// New takes an app and bot token, verifies the connection and
Expand All @@ -34,21 +34,21 @@ func New(appToken, botToken string) (*Slack, error) {
if _, err = slackBot.Client.AuthTest(); err != nil {
return nil, err
}
return &Slack{app: slackApp, bot: slackBot}, nil
return &Slack{App: slackApp, Bot: slackBot}, nil
}

// OpenDialog opens a Dialog inside Slack
func (s *Slack) OpenDialog(triggerID string, dialog slack.Dialog) error {
err := s.app.OpenDialog(triggerID, dialog)
err := s.App.OpenDialog(triggerID, dialog)
if err != nil {
fmt.Errorf("error opening dialog. %s", err)
fmt.Printf("error opening dialog. %s\n", err)
return err
}
return err
}

// SendMessage posts a message to Slack that is visible to everyone in the channel
func (s *Slack) SendMessage(message, channel string) {
msg := s.bot.RTM.NewOutgoingMessage(message, fmt.Sprintf("#%s", channel))
s.bot.RTM.SendMessage(msg)
msg := s.Bot.RTM.NewOutgoingMessage(message, fmt.Sprintf("#%s", channel))
s.Bot.RTM.SendMessage(msg)
}

0 comments on commit 2d6486b

Please sign in to comment.