是否可以有一个列表来存储机器人回复的最近推文的ID,而不是将其保存在文本文件中?
def on_status(self, status):
timelineTweets = api.user_timeline(screen_name="USERNAME")
alreadyReplied = [-1]
if timelineTweets[0].id not in alreadyReplied:
lastTweet = timelineTweets[0]
api.update_status('@USERNAME' + gettext(), in_reply_to_status_id=lastTweet.id)
alreadyReplied.append(lastTweet.id)
if len(alreadyReplied) == 20:
alreadyReplied.pop()
return True