Skip to content

Commit

Permalink
TG reply in topics
Browse files Browse the repository at this point in the history
  • Loading branch information
jmilldotdev committed Jan 26, 2025
1 parent e0bc063 commit 9aaa2b3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
1 change: 1 addition & 0 deletions eve/api/api_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ class UpdateConfig(BaseModel):
discord_channel_id: Optional[str] = None
telegram_chat_id: Optional[str] = None
telegram_message_id: Optional[str] = None
telegram_thread_id: Optional[str] = None
cast_hash: Optional[str] = None
author_fid: Optional[int] = None
message_id: Optional[str] = None
Expand Down
7 changes: 7 additions & 0 deletions eve/clients/telegram/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,7 @@ async def async_callback(message):
update_config = data.get("update_config", {})
telegram_chat_id = update_config.get("telegram_chat_id")
telegram_message_id = update_config.get("telegram_message_id")
telegram_thread_id = update_config.get("telegram_thread_id")

if not telegram_chat_id:
print("No telegram_chat_id in update_config:", data)
Expand Down Expand Up @@ -230,6 +231,7 @@ async def async_callback(message):
chat_id=telegram_chat_id,
text=content,
reply_to_message_id=telegram_message_id,
message_thread_id=telegram_thread_id,
)

elif update_type == UpdateType.TOOL_COMPLETE:
Expand All @@ -247,12 +249,14 @@ async def async_callback(message):
chat_id=telegram_chat_id,
video=url,
reply_to_message_id=telegram_message_id,
message_thread_id=telegram_thread_id,
)
else:
await application.bot.send_photo(
chat_id=telegram_chat_id,
photo=url,
reply_to_message_id=telegram_message_id,
message_thread_id=telegram_thread_id,
)

elif update_type == UpdateType.END_PROMPT:
Expand Down Expand Up @@ -382,6 +386,9 @@ async def echo(self, update: Update, context: ContextTypes.DEFAULT_TYPE):
"sub_channel_name": self.channel_name,
"telegram_chat_id": str(chat_id),
"telegram_message_id": str(message.message_id),
"telegram_thread_id": str(message_thread_id)
if message_thread_id
else None,
},
}

Expand Down

0 comments on commit 9aaa2b3

Please sign in to comment.