Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def process_mentions()
- mentions = find_mentions(last_processed_id())
- @highest_id_processed_locally = 0
- mentions.each do |m|
- id = 0 #test value
- @highest_id_processed_locally = id if id > last_processed_id()
- DATABASE.set("last_processed_id", @highest_id_processed_locally)
- text = m.text.strip.downcase
- user = m.user.screen_name
- id = m.id
- reply = "@" + user
- if text == "all"
- reply << "You're marked in the queue as eligible for all future games." +
- "If you ever change your mind, just reply to any tweet of mine with 'remove'"
- player_to_db(id, user, 1)
- elsif text == "remove"
- reply << "You've been removed from the queue of future eligible players. If" +
- " you're in an existing game, that game will still complete first as normal." +
- "Reply to one of my tweets again if you ever want to be readded!"
- hashname = "eligible_player_" + id
- DATABASE.del(hashname)
- else
- reply << "You've been added to the queue as eligible for future games! You'll" +
- "remain eligible for the next week. Reply with 'all' to stay eligible forever, or" +
- "'remove' to be removed from the queue."
- # add this player to redis with expirary of one week
- player_to_db(id, user, 0)
- end
- options = { in_reply_to_status_id: id }
- #client.update(reply, options)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement