lib/chatterbot/logging.rb in chatterbot-0.7.1 vs lib/chatterbot/logging.rb in chatterbot-0.9.0
- old
+ new
@@ -25,13 +25,14 @@
# log a tweet to the database
def log(txt, source=nil)
return unless log_tweets?
data = {:txt => txt, :bot => botname, :created_at => Time.now}
+
if source != nil
- data = data.merge(:user => source[:from_user],
- :source_id => source[:id],
- :source_tweet => source[:text])
+ data = data.merge(:user => source.user.screen_name,
+ :source_id => source.id,
+ :source_tweet => source.text)
end
# populate the table
db[:tweets].insert(data)
end