Module: Chatterbot::Whitelist
- Included in:
- Bot
- Defined in:
- lib/chatterbot/whitelist.rb
Overview
methods for only tweeting to users on a specific list
Instance Attribute Summary collapse
-
#whitelist ⇒ Object
A list of Twitter users that we can communicate with.
Instance Method Summary collapse
- #has_whitelist? ⇒ Boolean
-
#on_whitelist?(s) ⇒ Boolean
Is this tweet from a user on our whitelist?.
Instance Attribute Details
#whitelist ⇒ Object
A list of Twitter users that we can communicate with
9 10 11 |
# File 'lib/chatterbot/whitelist.rb', line 9 def whitelist @whitelist end |
Instance Method Details
#has_whitelist? ⇒ Boolean
21 22 23 |
# File 'lib/chatterbot/whitelist.rb', line 21 def has_whitelist? !whitelist.empty? end |
#on_whitelist?(s) ⇒ Boolean
Is this tweet from a user on our whitelist?
27 28 29 30 |
# File 'lib/chatterbot/whitelist.rb', line 27 def on_whitelist?(s) search = (s.respond_to?(:user) ? from_user(s) : s).downcase whitelist.any? { |b| search.include?(b.downcase) } end |