mirror of
https://github.com/jxxghp/MoviePilot.git
synced 2026-09-05 23:47:41 +08:00
fix
This commit is contained in:
@@ -188,8 +188,8 @@ class TelegramModule(_ModuleBase, _MessageBase[Telegram]):
|
|||||||
)
|
)
|
||||||
return None
|
return None
|
||||||
|
|
||||||
@staticmethod
|
def _handle_text_message(self, msg: dict,
|
||||||
def _handle_text_message(msg: dict, client_config: NotificationConf, client: Telegram) -> Optional[CommingMessage]:
|
client_config: NotificationConf, client: Telegram) -> Optional[CommingMessage]:
|
||||||
"""
|
"""
|
||||||
处理普通文本消息
|
处理普通文本消息
|
||||||
"""
|
"""
|
||||||
@@ -204,7 +204,7 @@ class TelegramModule(_ModuleBase, _MessageBase[Telegram]):
|
|||||||
f"userid={user_id}, username={user_name}, chat_id={chat_id}, text={text}")
|
f"userid={user_id}, username={user_name}, chat_id={chat_id}, text={text}")
|
||||||
|
|
||||||
# Clean bot mentions from text to ensure consistent processing
|
# Clean bot mentions from text to ensure consistent processing
|
||||||
cleaned_text = TelegramModule._clean_bot_mention(text, client._bot_username if client else None)
|
cleaned_text = self._clean_bot_mention(text, client.bot_username if client else None)
|
||||||
|
|
||||||
# 检查权限
|
# 检查权限
|
||||||
admin_users = client_config.config.get("TELEGRAM_ADMINS")
|
admin_users = client_config.config.get("TELEGRAM_ADMINS")
|
||||||
|
|||||||
@@ -113,8 +113,8 @@ class Telegram:
|
|||||||
# 发送给主程序处理
|
# 发送给主程序处理
|
||||||
RequestUtils(timeout=15).post_res(self._ds_url, json=callback_json)
|
RequestUtils(timeout=15).post_res(self._ds_url, json=callback_json)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as err:
|
||||||
logger.error(f"处理按钮回调失败:{str(e)}")
|
logger.error(f"处理按钮回调失败:{str(err)}")
|
||||||
_bot.answer_callback_query(call.id, "处理失败,请重试")
|
_bot.answer_callback_query(call.id, "处理失败,请重试")
|
||||||
|
|
||||||
def run_polling():
|
def run_polling():
|
||||||
@@ -131,6 +131,14 @@ class Telegram:
|
|||||||
self._polling_thread.start()
|
self._polling_thread.start()
|
||||||
logger.info("Telegram消息接收服务启动")
|
logger.info("Telegram消息接收服务启动")
|
||||||
|
|
||||||
|
@property
|
||||||
|
def bot_username(self) -> Optional[str]:
|
||||||
|
"""
|
||||||
|
获取Bot用户名
|
||||||
|
:return: Bot用户名或None
|
||||||
|
"""
|
||||||
|
return self._bot_username
|
||||||
|
|
||||||
def _update_user_chat_mapping(self, userid: int, chat_id: int) -> None:
|
def _update_user_chat_mapping(self, userid: int, chat_id: int) -> None:
|
||||||
"""
|
"""
|
||||||
更新用户与聊天的映射关系
|
更新用户与聊天的映射关系
|
||||||
|
|||||||
Reference in New Issue
Block a user