fix: remove title truncation from alert backend builders
Mastodon, Bluesky, GitHub, GitLab, npm, PyPI, and arXiv backends no longer truncate content/descriptions in titles. Full text is shown on the PRIVMSG line; only !alert history keeps truncation. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -604,7 +604,7 @@ def _search_mastodon(keyword: str) -> list[dict]:
|
|||||||
continue
|
continue
|
||||||
acct = (status.get("account") or {}).get("acct", "")
|
acct = (status.get("account") or {}).get("acct", "")
|
||||||
content = _strip_html(status.get("content", ""))
|
content = _strip_html(status.get("content", ""))
|
||||||
title = f"@{acct}: {_truncate(content, 60)}" if acct else content
|
title = f"@{acct}: {content}" if acct else content
|
||||||
items.append({
|
items.append({
|
||||||
"id": status_url,
|
"id": status_url,
|
||||||
"title": title,
|
"title": title,
|
||||||
@@ -903,7 +903,7 @@ def _search_bluesky(keyword: str) -> list[dict]:
|
|||||||
display = author.get("displayName") or handle
|
display = author.get("displayName") or handle
|
||||||
record = post.get("record") or {}
|
record = post.get("record") or {}
|
||||||
text = record.get("text", "")
|
text = record.get("text", "")
|
||||||
title = f"@{display}: {_truncate(text, 60)}"
|
title = f"@{display}: {text}"
|
||||||
date = _parse_date(record.get("createdAt", ""))
|
date = _parse_date(record.get("createdAt", ""))
|
||||||
post_url = f"https://bsky.app/profile/{handle}/post/{rkey}" if handle else ""
|
post_url = f"https://bsky.app/profile/{handle}/post/{rkey}" if handle else ""
|
||||||
results.append({
|
results.append({
|
||||||
@@ -1143,7 +1143,7 @@ def _search_github(keyword: str) -> list[dict]:
|
|||||||
stars = repo.get("stargazers_count", 0)
|
stars = repo.get("stargazers_count", 0)
|
||||||
title = full_name
|
title = full_name
|
||||||
if description:
|
if description:
|
||||||
title += f": {_truncate(description, 50)}"
|
title += f": {description}"
|
||||||
if stars:
|
if stars:
|
||||||
title += f" [{stars}*]"
|
title += f" [{stars}*]"
|
||||||
date = _parse_date(repo.get("updated_at", ""))
|
date = _parse_date(repo.get("updated_at", ""))
|
||||||
@@ -1280,7 +1280,7 @@ def _search_gitlab(keyword: str) -> list[dict]:
|
|||||||
stars = repo.get("star_count", 0)
|
stars = repo.get("star_count", 0)
|
||||||
title = name
|
title = name
|
||||||
if description:
|
if description:
|
||||||
title += f": {_truncate(description, 50)}"
|
title += f": {description}"
|
||||||
if stars:
|
if stars:
|
||||||
title += f" [{stars}*]"
|
title += f" [{stars}*]"
|
||||||
date = _parse_date(repo.get("last_activity_at", ""))
|
date = _parse_date(repo.get("last_activity_at", ""))
|
||||||
@@ -1320,7 +1320,7 @@ def _search_npm(keyword: str) -> list[dict]:
|
|||||||
npm_url = links.get("npm", f"https://www.npmjs.com/package/{name}")
|
npm_url = links.get("npm", f"https://www.npmjs.com/package/{name}")
|
||||||
title = f"{name}@{version}" if version else name
|
title = f"{name}@{version}" if version else name
|
||||||
if description:
|
if description:
|
||||||
title += f": {_truncate(description, 50)}"
|
title += f": {description}"
|
||||||
date = _parse_date(pkg.get("date", ""))
|
date = _parse_date(pkg.get("date", ""))
|
||||||
results.append({
|
results.append({
|
||||||
"id": name, "title": title, "url": npm_url,
|
"id": name, "title": title, "url": npm_url,
|
||||||
@@ -1356,7 +1356,7 @@ def _search_pypi(keyword: str) -> list[dict]:
|
|||||||
pkg_name = title.split()[0] if title else ""
|
pkg_name = title.split()[0] if title else ""
|
||||||
display = title
|
display = title
|
||||||
if desc:
|
if desc:
|
||||||
display += f": {_truncate(desc, 50)}"
|
display += f": {desc}"
|
||||||
results.append({
|
results.append({
|
||||||
"id": pkg_name or link,
|
"id": pkg_name or link,
|
||||||
"title": display,
|
"title": display,
|
||||||
@@ -1393,7 +1393,7 @@ def _search_dockerhub(keyword: str) -> list[dict]:
|
|||||||
stars = item.get("star_count", 0)
|
stars = item.get("star_count", 0)
|
||||||
title = name
|
title = name
|
||||||
if description:
|
if description:
|
||||||
title += f": {_truncate(description, 50)}"
|
title += f": {description}"
|
||||||
if stars:
|
if stars:
|
||||||
title += f" [{stars}*]"
|
title += f" [{stars}*]"
|
||||||
hub_url = (
|
hub_url = (
|
||||||
|
|||||||
Reference in New Issue
Block a user