Hardcode Telegram market channel URL and update bot tests

This commit is contained in:
2569718930@qq.com
2026-04-01 20:34:41 +08:00
parent 65688dffd9
commit ee40045b70
2 changed files with 29 additions and 8 deletions
@@ -219,10 +219,7 @@ const TELEGRAM_GROUP_URL = String(
const TELEGRAM_BOT_URL = String(
process.env.NEXT_PUBLIC_TELEGRAM_BOT_URL || "https://t.me/WeatherQuant_bot",
).trim();
const TELEGRAM_MARKET_CHANNEL_URL = String(
process.env.NEXT_PUBLIC_TELEGRAM_MARKET_CHANNEL_URL ||
"https://t.me/+hGAk7JsjtdhiOTUx",
).trim();
const TELEGRAM_MARKET_CHANNEL_URL = "https://t.me/+hGAk7JsjtdhiOTUx";
const SUBSCRIPTION_HELP_HREF = "/subscription-help";
let walletConnectProviderCache: EvmProvider | null = null;
+28 -4
View File
@@ -9,11 +9,31 @@ class DummyBot:
self.replies = []
self.sent_messages = []
def reply_to(self, message, text, parse_mode=None):
self.replies.append({"text": text, "parse_mode": parse_mode, "chat_id": message.chat.id})
def reply_to(self, message, text, parse_mode=None, disable_web_page_preview=None):
self.replies.append(
{
"text": text,
"parse_mode": parse_mode,
"chat_id": message.chat.id,
"disable_web_page_preview": disable_web_page_preview,
}
)
def send_message(self, chat_id, text, parse_mode=None): # pragma: no cover
self.sent_messages.append({"chat_id": chat_id, "text": text, "parse_mode": parse_mode})
def send_message(
self,
chat_id,
text,
parse_mode=None,
disable_web_page_preview=None,
): # pragma: no cover
self.sent_messages.append(
{
"chat_id": chat_id,
"text": text,
"parse_mode": parse_mode,
"disable_web_page_preview": disable_web_page_preview,
}
)
def message_handler(self, *args, **kwargs): # pragma: no cover - decorator stub
def _decorator(func):
@@ -79,6 +99,10 @@ def test_basic_handler_markets_returns_summary(monkeypatch):
"src.utils.telegram_push.build_market_monitor_digest",
lambda config, slot_label="当前概览", top_n=None, force_refresh=False: "MARKET DIGEST",
)
monkeypatch.setattr(
"src.utils.telegram_push.load_cached_market_monitor_digest",
lambda: "",
)
monkeypatch.setattr(
"src.bot.handlers.basic.threading.Thread",
lambda target, name=None, daemon=None: SimpleNamespace(start=target),