fix(telegram,core): bare seeds stay silent in telegram
This commit is contained in:
@@ -978,6 +978,8 @@ class Conversations:
|
|||||||
stamp = datetime.now(UTC).astimezone().strftime("%Y-%m-%d %H:%M")
|
stamp = datetime.now(UTC).astimezone().strftime("%Y-%m-%d %H:%M")
|
||||||
title = f" «{ctx.title}»" if ctx.title else ""
|
title = f" «{ctx.title}»" if ctx.title else ""
|
||||||
head = f"[сид: {ctx.seed}] {ctx.kind}{title}, {stamp}."
|
head = f"[сид: {ctx.seed}] {ctx.kind}{title}, {stamp}."
|
||||||
|
if not ctx.text or ctx.seed == "brief":
|
||||||
|
head += " Это контекст, не обращение: отвечать не нужно."
|
||||||
body: str | None = None
|
body: str | None = None
|
||||||
if self._texts.seed is not None:
|
if self._texts.seed is not None:
|
||||||
produced: Any = self._texts.seed(ctx)
|
produced: Any = self._texts.seed(ctx)
|
||||||
|
|||||||
@@ -668,9 +668,7 @@ class TelegramFrontend(Frontend):
|
|||||||
key=f"{event.get('turn_id')}:error",
|
key=f"{event.get('turn_id')}:error",
|
||||||
)
|
)
|
||||||
case "reply":
|
case "reply":
|
||||||
if conv.kind == "master" and str(
|
if str(event.get("item_origin") or "").startswith("сид"):
|
||||||
event.get("item_origin") or ""
|
|
||||||
).startswith("сид"):
|
|
||||||
return
|
return
|
||||||
await self._on_reply(conv, event)
|
await self._on_reply(conv, event)
|
||||||
case "say":
|
case "say":
|
||||||
|
|||||||
@@ -459,6 +459,12 @@ async def test_commands_status_merge_and_new(stack: Stack) -> None:
|
|||||||
frontend="telegram", external_id=f"{USER}/902"
|
frontend="telegram", external_id=f"{USER}/902"
|
||||||
)
|
)
|
||||||
assert child is not None and child.title == "отчёт"
|
assert child is not None and child.title == "отчёт"
|
||||||
|
await stack.world.settle(child, 1)
|
||||||
|
await asyncio.sleep(0.2)
|
||||||
|
assert all(m["thread"] != 902 for m in stack.bot.sent)
|
||||||
|
stack.bot.message("первое в новый топик", thread=902)
|
||||||
|
reply = await stack.until(lambda: stack.sent_with("первое в новый топик"), what="r")
|
||||||
|
assert reply["thread"] == 902
|
||||||
assert await stack.tg.mark_topic(child)
|
assert await stack.tg.mark_topic(child)
|
||||||
assert stack.bot.topics[-1] == "edit:902:✅ отчёт"
|
assert stack.bot.topics[-1] == "edit:902:✅ отчёт"
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user