Class: Lita::Handlers::Receptionist
- Inherits:
-
Handler
- Object
- Handler
- Lita::Handlers::Receptionist
- Defined in:
- lib/lita/handlers/receptionist.rb
Instance Method Summary collapse
Instance Method Details
#add_repo(response) ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/lita/handlers/receptionist.rb', line 9 def add_repo(response) repo_name = "https://github.com/#{response.matches[0][0]}/#{response.matches[0][1]}" repos = redis.get('repos') || [] unless repos.include? repo_name repos << repo_name redis.set('repos', repos) response.reply "Repo added" end end |
#remove_repo(response) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/lita/handlers/receptionist.rb', line 20 def remove_repo(response) repo_name = "https://github.com/#{response.matches[0][0]}/#{response.matches[0][1]}" repos = redis.get('repos') || [] if repos.include? repo_name repos = repos.delete repo_name redis.set('repos', repos) response.reply "Repo removed" end end |