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

Instance Method Summary collapse

Instance Attribute Details

#safelistObject

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

Returns:

  • (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?

Returns:

  • (Boolean)


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

#whitelistObject

Returns the value of attribute safelist.



8
9
10
# File 'lib/chatterbot/safelist.rb', line 8

def safelist
  @safelist
end