Skip to content

Commit

Permalink
[#11] Join on invite
Browse files Browse the repository at this point in the history
  • Loading branch information
Bartosz Kopiński committed Apr 17, 2015
1 parent 6b634dd commit b21b1d6
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,9 @@ class MyBot < Hipbot::Bot

# Makes all reactions case insensitive (default: true)
c.case_insensitive = true

# Auto-join on invite (default: true)
c.join_on_invite = true
end
end
```
Expand Down
2 changes: 2 additions & 0 deletions lib/hipbot/callbacks/invite.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ module Hipbot
module Callbacks
class Invite < Base
def initialize room_id, user_name, room_name, topic
return unless Hipbot.configuration.join_on_invite

with_room(id: room_id, name: room_name, topic: topic) do |room|
Hipbot.join_room(room)
end
Expand Down
3 changes: 2 additions & 1 deletion lib/hipbot/configuration.rb
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
module Hipbot
class Configuration
OPTIONS = [
:adapter, :case_insensitive, :exception_handler, :helpers, :join,
:adapter, :case_insensitive, :exception_handler, :helpers, :join, :join_on_invite,
:logger, :password, :plugins, :preloader, :rooms, :status, :storage, :teams, :user
]
attr_accessor *OPTIONS
Expand All @@ -19,6 +19,7 @@ def initialize
end
self.helpers = Module.new
self.join = :all
self.join_on_invite = true
self.logger = Logger.new($stdout)
self.password = ''
self.plugins = Hipbot.plugins
Expand Down

0 comments on commit b21b1d6

Please sign in to comment.