mirror of
https://github.com/NousResearch/hermes-agent.git
synced 2026-06-16 09:31:37 +00:00
fix(telegram): send seed message after creating DM topics (#18334)
Telegram's client does not display empty forum topics in the chat's topic list. After createForumTopic succeeds, send a short pin message into the new topic so it becomes immediately visible to the user. Only fires for newly created topics (no thread_id in config yet). Failure to send the seed is non-fatal (debug-logged, topic still works).
This commit is contained in:
parent
0159f25fd0
commit
75e1339d4c
1 changed files with 14 additions and 0 deletions
|
|
@ -761,6 +761,20 @@ class TelegramAdapter(BasePlatformAdapter):
|
|||
# Persist thread_id to config so we don't recreate on next restart
|
||||
self._persist_dm_topic_thread_id(int(chat_id), topic_name, thread_id)
|
||||
|
||||
# Send a seed message so the topic is visible in Telegram's client.
|
||||
# Empty topics are hidden by the client UI until they contain a message.
|
||||
try:
|
||||
await self._bot.send_message(
|
||||
chat_id=int(chat_id),
|
||||
message_thread_id=thread_id,
|
||||
text=f"\U0001f4cc {topic_name}",
|
||||
)
|
||||
except Exception as seed_err:
|
||||
logger.debug(
|
||||
"[%s] Could not send seed message to topic '%s': %s",
|
||||
self.name, topic_name, seed_err,
|
||||
)
|
||||
|
||||
async def connect(self) -> bool:
|
||||
"""Connect to Telegram via polling or webhook.
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue