module Chatterbot::Safelist

methods for only tweeting to users on a specific list

Attributes

safelist[RW]
whitelist[RW]

Public Instance Methods

has_safelist?() click to toggle source
# File lib/chatterbot/safelist.rb, line 22
def has_safelist?
  !safelist.empty?
end
on_safelist?(s) click to toggle source

Is this tweet from a user on our safelist?

# File lib/chatterbot/safelist.rb, line 28
def on_safelist?(s)
  search = from_user(s).downcase
  safelist.any? { |b| search.include?(b.downcase) }
end
safelist=(b) click to toggle source
# File lib/chatterbot/safelist.rb, line 15
def safelist=(b)
  @safelist = b.flatten.collect { |e|
    from_user(e).downcase
  }
  @safelist
end