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