Skip to content

Commit

Permalink
add changelog + update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
accessd committed May 14, 2016
1 parent f199200 commit 8046fb7
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
### 0.8.1 (Next)

* Your contribution here.
* [#69](https://github.com/dblock/slack-ruby-bot/pull/69): Ability to add help info to bot and commands - [@accessd](https://github.com/accessd).

### 0.8.0 (5/5/2016)

Expand Down
41 changes: 41 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -140,6 +140,47 @@ end

See [examples/market](examples/market/marketbot.rb) for a working example.

### Providing description for your bot and commands

You can specify help information for bot or commands with `help` block, for example:

in case of bot:

```ruby
class WeatherBot < SlackRubyBot::Bot
help do
title 'Weather Bot'
desc 'This bot tells you the weather.'

command 'clouds' do
desc 'Tells you how many clouds there\'re above you.'
end

command 'What\'s the weather in <city>?' do
desc 'Tells you the weather in a <city>.'
long_desc "Accurate 10 Day Weather Forecasts for thousands of places around the World.\n" \
'Bot provides detailed Weather Forecasts over a 10 day period updated four times a day.'
end
end

# commands implementation
end
```

![](screenshots/help-command-examples.png)

in case of your own command:

```ruby
class Deploy < SlackRubyBot::Commands::Base
help do
title 'deploy'
desc 'deploys your app'
long_desc 'command format: *deploy <branch> to <env>* where <env> is production or staging'
end
end
```

### SlackRubyBot::Commands::Base

The `SlackRubyBot::Bot` class is DSL sugar deriving from `SlackRubyBot::Commands::Base`. For more involved bots you can organize the bot implementation into subclasses of `SlackRubyBot::Commands::Base` manually. By default a command class responds, case-insensitively, to its name. A class called `Phone` that inherits from `SlackRubyBot::Commands::Base` responds to `phone` and `Phone` and calls the `call` method when implemented.
Expand Down
2 changes: 0 additions & 2 deletions lib/slack-ruby-bot/rspec/support/bots_for_tests.rb
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,7 @@ class WeatherBot < SlackRubyBot::Bot
end
end
end
end

module Testing
class HelloCommand < SlackRubyBot::Commands::Base
help do
title 'hello'
Expand Down
Binary file added screenshots/help-command-examples.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes.

0 comments on commit 8046fb7

Please sign in to comment.