Archived
1
0
Fork 0
This repository has been archived on 2024-04-26. You can view files and clone it, but cannot push or open issues or pull requests.
akari-bot/modules/mod_dl/__init__.py
2022-05-22 00:04:29 +08:00

23 lines
800 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

from core.component import on_command
from core.elements import MessageSession, Url
from .mod_dl import curseforge as d
mod_dl = on_command(
bind_prefix='mod_dl',
desc='下载CurseForge上的Mod。',
developers=['HornCopper'],
recommend_modules=['mcmod'],
alias='moddl')
@mod_dl.handle('<mod_name> <mcversion> {通过模组名获取模组下载链接CloudFlare CDN支持。}')
async def main(msg: MessageSession):
info = await d(msg.parsed_msg['<mod_name>'], msg.parsed_msg['<mcversion>'])
if not info['success']:
await msg.finish(info['msg'])
link = info["download_link"]
name = info["filename"]
status = info["status"]
message = f'下载链接:{str(Url(link))}\n文件名:{name}\n版本状态:{status}'
await msg.finish(message)