Skip to content

Commit

Permalink
Address bot by name:, closes slack-ruby#17.
Browse files Browse the repository at this point in the history
  • Loading branch information
dblock committed Sep 23, 2015
1 parent 06b721f commit 715ff28
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
### 0.4.4 (Next)

* [#17](https://github.com/dblock/slack-ruby-bot/issues/17): Address bot by `name:` - [@dblock](https://githubcom/dblock).
* [#19](https://github.com/dblock/slack-ruby-bot/issues/19): Retry on `Faraday::Error::TimeoutError`, `TimeoutError` and `SSLError` - [@dblock](https://githubcom/dblock).
* [#3](https://github.com/dblock/slack-ruby-bot/issues/3): Retry on `migration_in_progress` errors during `rtm.start` - [@dblock](https://githubcom/dblock).
* Respond to direct messages without being addressed by name - [@dblock](https://githubcom/dblock).
Expand Down
2 changes: 1 addition & 1 deletion lib/slack-ruby-bot/config.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ module Config
attr_accessor :team_id

def names
[user, aliases, "<@#{user_id.downcase}>", "<@#{user_id.downcase}>:"].compact.flatten
[user, aliases, "<@#{user_id.downcase}>", "<@#{user_id.downcase}>:", "#{user}:"].compact.flatten
end

def name?(name)
Expand Down
3 changes: 3 additions & 0 deletions spec/slack-ruby-bot/commands/about_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ def app
it 'upcase' do
expect(message: SlackRubyBot.config.user.upcase).to respond_with_slack_message(SlackRubyBot::ABOUT)
end
it 'name:' do
expect(message: "#{SlackRubyBot.config.user}:").to respond_with_slack_message(SlackRubyBot::ABOUT)
end
it 'id' do
expect(message: "<@#{SlackRubyBot.config.user_id}>").to respond_with_slack_message(SlackRubyBot::ABOUT)
end
Expand Down
3 changes: 3 additions & 0 deletions spec/slack-ruby-bot/commands/hi_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ def app
it 'says hi' do
expect(message: "#{SlackRubyBot.config.user} hi").to respond_with_slack_message('Hi <@user>!')
end
it 'says hi to bot:' do
expect(message: "#{SlackRubyBot.config.user}: hi").to respond_with_slack_message('Hi <@user>!')
end
it 'says hi to @bot' do
expect(message: "<@#{SlackRubyBot.config.user_id}> hi").to respond_with_slack_message('Hi <@user>!')
end
Expand Down

0 comments on commit 715ff28

Please sign in to comment.