Restrict /markets to private chats

This commit is contained in:
2569718930@qq.com
2026-04-01 18:34:58 +08:00
parent c9719cf577
commit b1b8d3439c
3 changed files with 39 additions and 2 deletions
+9
View File
@@ -247,6 +247,15 @@ class BasicCommandHandler:
def handle_markets(self, message: Any) -> None:
trace = CommandTrace("/markets", message)
try:
chat_type = str(getattr(getattr(message, "chat", None), "type", "") or "").strip().lower()
if chat_type and chat_type != "private":
self.bot.reply_to(
message,
"️ `/markets` 仅支持私聊机器人查询。\n频道继续接收自动推送;如需手动查看当前市场概览,请私聊 bot 发送 `/markets`。",
parse_mode="Markdown",
)
trace.set_status("blocked", f"unsupported_chat_type:{chat_type}")
return
from src.utils.telegram_push import build_market_monitor_digest
summary = build_market_monitor_digest(