Fix error with no attribute 'retweeted_status'
This commit is contained in:
parent
8b568d3daa
commit
8048622707
1 changed files with 3 additions and 2 deletions
|
@ -57,11 +57,12 @@ class TwitterCog(commands.Cog):
|
||||||
self._channel_cache[twitter.channel] = find(lambda x: x.id == twitter.channel, channels)
|
self._channel_cache[twitter.channel] = find(lambda x: x.id == twitter.channel, channels)
|
||||||
channel = self._channel_cache[twitter.channel]
|
channel = self._channel_cache[twitter.channel]
|
||||||
for tweet in tweets:
|
for tweet in tweets:
|
||||||
if tweet.retweeted_status and not twitter.retweets:
|
retweet = "retweeted_status" in tweet.__dict__
|
||||||
|
if retweet and not twitter.retweets:
|
||||||
continue
|
continue
|
||||||
timestamp = int(tweet.created_at.timestamp())
|
timestamp = int(tweet.created_at.timestamp())
|
||||||
url = f"https://twitter.com/{twitter.handle}/status/{tweet.id}"
|
url = f"https://twitter.com/{twitter.handle}/status/{tweet.id}"
|
||||||
verb = "re" if tweet.retweeted_status else ""
|
verb = "re" if retweet else ""
|
||||||
await channel.send(f"`@{twitter.handle}` {verb}tweeted this at <t:{timestamp}:f>: {url}")
|
await channel.send(f"`@{twitter.handle}` {verb}tweeted this at <t:{timestamp}:f>: {url}")
|
||||||
newest = max(tweets, key=lambda x: x.id)
|
newest = max(tweets, key=lambda x: x.id)
|
||||||
twitter.last_tweet = newest.id
|
twitter.last_tweet = newest.id
|
||||||
|
|
Loading…
Add table
Reference in a new issue