Fix Telegram bot binding fallback
This commit is contained in:
@@ -181,6 +181,56 @@ def test_confirm_bind_callback_consumes_token_and_binds_account():
|
||||
assert bound[0]["supabase_user_id"] == "user-1"
|
||||
|
||||
|
||||
def test_private_text_fallback_replies_with_binding_help():
|
||||
bot = DummyBot()
|
||||
io_layer = SimpleNamespace(
|
||||
build_welcome_text=lambda: "WELCOME",
|
||||
build_points_rank_text=lambda _user: "TOP",
|
||||
)
|
||||
handler = BasicCommandHandler(
|
||||
bot=bot,
|
||||
io_layer=io_layer,
|
||||
runtime_status_provider=lambda: RuntimeStatus(
|
||||
started_at="2026-03-12 00:00:00 UTC",
|
||||
loops=[],
|
||||
command_access_mode="group_member",
|
||||
protected_commands=["/city", "/deb"],
|
||||
required_group_chat_id="-1001234567890",
|
||||
),
|
||||
)
|
||||
|
||||
result = handler.handle_private_text_fallback(_message("@polyyuanbot"))
|
||||
|
||||
assert result == "replied"
|
||||
assert len(bot.replies) == 1
|
||||
assert "/start bind_" in bot.replies[0]["text"]
|
||||
assert "/help" in bot.replies[0]["text"]
|
||||
|
||||
|
||||
def test_private_text_fallback_ignores_slash_commands():
|
||||
bot = DummyBot()
|
||||
io_layer = SimpleNamespace(
|
||||
build_welcome_text=lambda: "WELCOME",
|
||||
build_points_rank_text=lambda _user: "TOP",
|
||||
)
|
||||
handler = BasicCommandHandler(
|
||||
bot=bot,
|
||||
io_layer=io_layer,
|
||||
runtime_status_provider=lambda: RuntimeStatus(
|
||||
started_at="2026-03-12 00:00:00 UTC",
|
||||
loops=[],
|
||||
command_access_mode="group_member",
|
||||
protected_commands=["/city", "/deb"],
|
||||
required_group_chat_id="-1001234567890",
|
||||
),
|
||||
)
|
||||
|
||||
result = handler.handle_private_text_fallback(_message("/city seoul"))
|
||||
|
||||
assert result == "ignored:slash_command"
|
||||
assert bot.replies == []
|
||||
|
||||
|
||||
def test_basic_handler_markets_returns_summary():
|
||||
bot = DummyBot()
|
||||
io_layer = SimpleNamespace(
|
||||
|
||||
Reference in New Issue
Block a user