RSS bot: drop /new command — purely publishing

Remove the /new command, the on-connect latest-items send, the _rss_send_latest
helper and the now-unused rss_items cache. The bot only watches the feed and
broadcasts new posts to its channel. Update welcome + UI copy to drop /new.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
Jon
2026-06-05 21:33:58 +01:00
parent 908d16bfc3
commit 1bd0bd9c7b
2 changed files with 5 additions and 36 deletions

View File

@@ -159,7 +159,6 @@ class RunningBot:
histories: dict[int, list[dict]] = field(default_factory=dict)
# RSS bot state
rss_seen: set = field(default_factory=set) # entry ids already posted
rss_items: list = field(default_factory=list) # latest fetched entries (newest first)
rss_next_poll: float = 0.0
rss_gid: int | None = None # broadcast channel group id
@@ -504,7 +503,6 @@ async def _rss_poll(b: "RunningBot", chat: Any, gid: int | None, config: dict, s
log.error("rss fetch error: %s", e)
_append_log(b, f"RSS fetch error: {e}")
return
b.rss_items = entries
new = [e for e in entries if e["id"] not in b.rss_seen]
for e in new:
b.rss_seen.add(e["id"])
@@ -521,22 +519,6 @@ async def _rss_poll(b: "RunningBot", chat: Any, gid: int | None, config: dict, s
_append_log(b, f"RSS posted {len(new)} new item(s)")
async def _rss_send_latest(chat: Any, item: dict, b: "RunningBot", n: int = 3) -> None:
"""Reply to a direct request (e.g. /new) with the latest feed items."""
items = b.rss_items[:n]
if not items:
try:
await chat.api_send_text_reply(item, "No items yet — check back soon.")
except Exception:
pass
return
for e in items:
try:
await chat.api_send_text_reply(item, _rss_format(e))
except Exception:
pass
async def _run_bot(
profile_id: int,
name: str,
@@ -599,7 +581,7 @@ async def _run_bot(
# auto-reply greets each new contact (default lists allowed publishers)
settings["autoReply"] = {"type": "text", "text": _bc_welcome(config, name)}
elif bot_type == "rss":
welcome = config.get("welcome_message") or f"Subscribed to {name}. Send /new for the latest posts."
welcome = config.get("welcome_message") or f"You're subscribed to {name}."
settings["autoReply"] = {"type": "text", "text": welcome}
elif bot_type in ("echo", "llm", "directory", "deadmans"):
welcome = config.get("welcome_message", f"Connected to {name}.")
@@ -679,16 +661,7 @@ async def _run_bot(
_append_log(b, f"Contact connected: {ct_name}")
# echo replies on message; broadcast/others greet via the auto-reply
# configured in address settings. RSS also sends the latest items on connect.
if bot_type == "rss":
cid = ct.get("contactId")
if cid is not None: # send the latest items directly to the new contact
for e in b.rss_items[:3]:
try:
await chat.api_send_text_message(
{"chatType": "direct", "chatId": cid}, _rss_format(e))
except Exception:
pass
# configured in address settings, so nothing to do on connect here.
elif tag == "newChatItems":
items = evt.get("chatItems", [])
@@ -743,10 +716,6 @@ async def _run_bot(
b, chat, config, item, chat_info, text, DEFAULT_LLM_PROMPT
)
elif bot_type == "rss" and text:
if text.strip().lower() == "/new":
await _rss_send_latest(chat, item, b)
elif bot_type == "directory" and text:
await _handle_directory_message(
b, chat, config, name, item, chat_info, text

View File

@@ -49,7 +49,7 @@
<table>
<tr><td><span class="tag">echo</span></td><td class="muted">Repeats every message back to the sender — handy for testing a connection end to end.</td></tr>
<tr><td><span class="tag">llm</span></td><td class="muted">Chat with a local or remote LLM (OpenAI-compatible, e.g. Ollama). Give it context, it replies to your messages.</td></tr>
<tr><td><span class="tag">rss</span></td><td class="muted">Watches an RSS/Atom feed and broadcasts new posts to a channel it creates. Subscribers join the channel; send /new for the latest.</td></tr>
<tr><td><span class="tag">rss</span></td><td class="muted">Watches an RSS/Atom feed and broadcasts new posts to a channel it creates. Subscribers join the channel to receive them.</td></tr>
<tr><td><span class="tag">broadcast</span></td><td class="muted">Relays messages from authorized publishers out to all of the bot's contacts.</td></tr>
<tr><td><span class="tag">support</span></td><td class="muted">Business inbox — auto-replies with a welcome message and collects incoming inquiries.</td></tr>
<tr><td><span class="tag">directory</span></td><td class="muted">Directory service for discovering and listing groups or contacts.</td></tr>
@@ -229,8 +229,8 @@
<div style="border-top:1px solid var(--border);margin:4px 0 14px;padding-top:14px;">
<p class="muted" style="margin-bottom:12px;">
The bot watches this feed and broadcasts new posts to a channel it creates.
Share the channel link (from the bot's profile) with subscribers; anyone messaging
the bot can send <code>/new</code> for the latest.
Share the channel link (from the bot's profile) with subscribers — new posts
appear there automatically.
</p>
</div>
<div class="field">