min_id = ""
File.open('dictionaries/latest_loaded_id.txt', 'r') do |latest_loaded_id|
min_id = latest_loaded_id.read
end
max_id = client.home_timeline.first.id
File.open('dictionaries/latest_loaded_id.txt', 'w') do |f|
f.puts(max_id)
end
@vocList = []
open('dictionaries/vocList.txt') do |f|
f.each do |line|
a, b = line.split(/\t/)
@vocList << [a, b]
end
end
client.home_timeline(since_id: min_id, count: 200).each do |tweet|
if (tweet.full_text.include?("jelik_kotzij"))
&& (tweet.user.name != "Kotz'i'j")
reply = ""
if (tweet.full_text.include?("utz awach"))
reply = "Utz maltyox! E le at?"
elsif (tweet.full_text.include?("mo se dice"))
@vocList.each do |word|
if tweet.full_text.include?(word[0])
reply = word[1]
break
end
end
if(reply == "")
reply = "No lo sé todavía..."
end
else
originalTweet = tweet.full_text.gsub("@jelik_kotzij", "")
originalTweet = originalTweet.delete("!?")
reply = "Jas " + originalTweet + "?"
end
client.update('@'+tweet.user.screen_name + " "
+ reply, {:in_reply_to_status_id => tweet.id})
end
end