def HandleOneMention(self, mention):
''' Like the tweet that mentions us. If the word 'tick' appears
in that tweet, also reply with the current time.
'''
who = mention['user']['screen_name']
text = mention['text']
theId = mention['id_str']
eventType = "Mention"
# we favorite every mention that we see
if self.debug:
print "Faving tweet {0} by {1}:\n {2}".format(theId, who, text.encode("utf-8"))
else:
self.twitter.create_favorite(id=theId)
if 'tick' in text.lower():
# reply to them with the current time.
replyMsg = "@{0} {1}".format(who, NowString(datetime.now()))
if self.debug:
print "REPLY: {}".format(replyMsg)
else:
self.tweets.append({'status': replyMsg, 'in_reply_to_status_id': theId})
eventType = "Reply"
self.Log(eventType, [who])
评论列表
文章目录