twitterbridge: decide new vs old by status id, not feed position
RSSHub's guid is the timeline entry's own id (a retweet's id), so ids follow the order the account posted, while feed order and pubDate follow the original tweet. A fresh retweet of an old post can sort to the bottom; it is now posted, and only ids older than every known one are treated as deletion slide-ins. !leaks sorts by id too. Co-Authored-By: Claude Opus 5.5 <[email protected]>
This commit is contained in:
1 parent
f8b3501637
commit
2af2adc780
2 files changed
+31
-12
No files matched your search
@@ -3,7 +3,7 @@ import aiohttp
|
||||
import feedparser
|
||||
from discord.ext import commands
|
||||
|
||||
from twitterbridge.rss import embed_link
|
||||
from twitterbridge.rss import embed_link, tweet_id
|
||||
|
||||
REQUEST_TIMEOUT = 15
|
||||
|
||||
@@ -51,6 +51,8 @@ class TwitterLeaks(commands.Cog):
|
||||
return await ctx.reply(msg[:2000])
|
||||
|
||||
response = "**Latest 5 Leaks:**\n"
|
||||
# the feed isn't chronological; status ids are
|
||||
entries = sorted(entries, key=lambda e: tweet_id(e.get('id') or e.get('link', '')) or 0, reverse=True)
|
||||
for entry in entries[:5]:
|
||||
response += f"\n{embed_link(entry.get('link', ''))}\n"
|
||||
|
||||
|
||||
Reference in new issue
Block a user