feat: enhance Telegram module with new functionality and improvements.

This commit is contained in:
jxxghp
2026-03-08 09:48:42 +08:00
parent 6a90e2c796
commit 6f63e0a5d7

View File

@@ -80,6 +80,11 @@ class Telegram:
# Check if we should process this message # Check if we should process this message
if self._should_process_message(message): if self._should_process_message(message):
# 发送正在输入状态
try:
_bot.send_chat_action(message.chat.id, 'typing')
except Exception as e:
logger.error(f"发送Telegram正在输入状态失败{e}")
RequestUtils(timeout=15).post_res(self._ds_url, json=message.json) RequestUtils(timeout=15).post_res(self._ds_url, json=message.json)
@_bot.callback_query_handler(func=lambda call: True) @_bot.callback_query_handler(func=lambda call: True)
@@ -115,6 +120,12 @@ class Telegram:
# 先确认回调避免用户看到loading状态 # 先确认回调避免用户看到loading状态
_bot.answer_callback_query(call.id) _bot.answer_callback_query(call.id)
# 发送正在输入状态
try:
_bot.send_chat_action(call.message.chat.id, 'typing')
except Exception as e:
logger.error(f"发送Telegram正在输入状态失败{e}")
# 发送给主程序处理 # 发送给主程序处理
RequestUtils(timeout=15).post_res(self._ds_url, json=callback_json) RequestUtils(timeout=15).post_res(self._ds_url, json=callback_json)