feat: add URL shortening to subscription announcements
Bot.shorten_url() method delegates to flaskpaste plugin when loaded. RSS, YouTube, and pastemoni announcements auto-shorten links. Includes test_flaskpaste.py (9 cases) and FakeBot updates in 3 test files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -275,6 +275,8 @@ async def _poll_once(bot, key: str, announce: bool = True) -> None:
|
||||
title = item.get("title") or "(untitled)"
|
||||
snippet = item.get("snippet", "")
|
||||
url = item.get("url", "")
|
||||
if url:
|
||||
url = await bot.shorten_url(url)
|
||||
parts = [f"[{tag}] {title}"]
|
||||
if snippet:
|
||||
parts.append(snippet)
|
||||
|
||||
@@ -272,6 +272,8 @@ async def _poll_once(bot, key: str, announce: bool = True) -> None:
|
||||
for item in shown:
|
||||
title = _truncate(item["title"]) if item["title"] else "(no title)"
|
||||
link = item["link"]
|
||||
if link:
|
||||
link = await bot.shorten_url(link)
|
||||
date = item.get("date", "")
|
||||
line = f"[{name}] {title}"
|
||||
if date:
|
||||
|
||||
@@ -394,6 +394,8 @@ async def _poll_once(bot, key: str, announce: bool = True) -> None:
|
||||
for item in shown:
|
||||
title = _truncate(item["title"]) if item["title"] else "(no title)"
|
||||
link = item["link"]
|
||||
if link:
|
||||
link = await bot.shorten_url(link)
|
||||
# Build metadata suffix
|
||||
parts = []
|
||||
dur = durations.get(item["id"], 0)
|
||||
|
||||
Reference in New Issue
Block a user