防止漫游器回复已经回复的推文?

时间:2020-08-05 03:28:05

标签: python api twitter bots tweepy

是否可以有一个列表来存储机器人回复的最近推文的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

0 个答案:

没有答案