Method: ChatBot#initialize
- Defined in:
- lib/chatx.rb
#initialize(email, password, **opts) ⇒ ChatBot
Creates a bot.
These must be stack exchange openid credentials, and the user must have spoken in a room on that server first.
For further details on authentication, see #authenticate
50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/chatx.rb', line 50 def initialize(email, password, **opts) opts[:default_server] ||= 'stackexchange' opts[:log_location] ||= STDOUT opts[:log_level] ||= Logger::DEBUG @logger = Logger.new opts[:log_location] @logger.level = opts[:log_level] @ws_json_logger = Logger.new 'websockets_json.log' # Both of these can be overriden in #login with cookie: @email = email @password = password @agent = Mechanize.new @rooms = {} # room_id => {events} @default_server = opts[:default_server] @hooks = {'*' => []} @websockets = {} at_exit { rejoin } end |