feat: stardew valley mod lookup

This commit is contained in:
草师傅 2025-09-08 16:47:52 +08:00
parent a216412ab6
commit 606e185c1c
2 changed files with 7 additions and 1 deletions

View file

@ -22,7 +22,7 @@ from core.promote import handle_promote_command
from core.repeater import MessageRepeater
from core.report_links import report_broken_links
from core.simple import handle_start_command, handle_baka, dummy_handler, handle_info_command, handle_ping_command, \
handle_tips_command, handle_about_command
handle_tips_command, handle_about_command, handle_nexusmods_id
from core.actions import handle_actions, handle_reverse_actions
from core.stats import handle_stats_command
from core.middleware.stats import MessageStatsMiddleware
@ -77,6 +77,7 @@ class TelegramAdapter:
handle_unpin_channel_message)
# repeater 模块
repeater_router.message(F.chat.type.in_({'group', 'supergroup'}))(MessageRepeater().handle_message)
router.message(F.text.regexp(r'(n|N) ?网尾号 ?[0-9]*'))(handle_nexusmods_id)
router.message(F.text == '我是笨蛋')(handle_baka)
router.inline_query()(handle_inline_query)
# 捕获所有其他消息

View file

@ -88,6 +88,11 @@ async def handle_about_command(message: Message) -> None:
response += f"也就大概花了 {minutes}{seconds} 秒..."
await about_message.edit_text(response)
async def handle_nexusmods_id(message: Message) -> None:
"""输入n网尾号xxxx之后主动返回星露谷物语的对应mod"""
nexusmods_id = message.text.replace(" ","").replace("N网尾号","").replace("n网尾号","")
await message.reply(f"https://www.nexusmods.com/stardewvalley/mods/{nexusmods_id}")
async def dummy_handler(message: Message) -> None:
"""A handler to catch all other messages"""
pass