diff --git a/nonebot_plugin_multincm/__main__.py b/nonebot_plugin_multincm/__main__.py index ae21bf5..625b59b 100644 --- a/nonebot_plugin_multincm/__main__.py +++ b/nonebot_plugin_multincm/__main__.py @@ -34,6 +34,7 @@ KEY_RESOLVE = "resolve" KEY_SEND_LINK = "send_link" KEY_UPLOAD_FILE = "upload_file" +KEY_SEND_RECORD = "send_record" KEY_IS_AUTO_RESOLVE = "is_auto_resolve" KEY_ILLEGAL_COUNT = "illegal_count" @@ -501,6 +502,11 @@ def reg_one(s: Type[BaseSearcher]): aliases={"upload"}, state={KEY_UPLOAD_FILE: True}, ) +cmd_send_record = on_command( + "发送语音", + aliases={"record"}, + state={KEY_SEND_RECORD: True}, +) cmd_auto_resolve = on_regex( URL_REGEX, state={KEY_RESOLVE: True, KEY_IS_AUTO_RESOLVE: True}, @@ -514,6 +520,7 @@ def reg_one(s: Type[BaseSearcher]): @cmd_resolve.handle() @cmd_resolve_url.handle() @cmd_resolve_file.handle() +@cmd_send_record.handle() @cmd_auto_resolve.handle() @cmd_auto_resolve_short.handle() async def _(matcher: Matcher, state: T_State, resolved: ResolvedSongOrPlaylist): @@ -546,6 +553,9 @@ async def _(matcher: Matcher, state: T_State, resolved: ResolvedSongOrPlaylist): ) await matcher.finish(f"上传{resolved.calling}失败,遇到未知错误,请检查后台输出") + elif KEY_SEND_RECORD in state: + await matcher.send(MessageSegment.record(await resolved.get_playable_url())) + await matcher.finish() diff --git a/pdm.lock b/pdm.lock index b11705d..75da0d1 100644 --- a/pdm.lock +++ b/pdm.lock @@ -5,7 +5,7 @@ groups = ["default", "playwright"] strategy = ["cross_platform"] lock_version = "4.4" -content_hash = "sha256:b1fd18f0af3b76b0e175600913feb99b1d1b13b8a4b646e3df5d0ec6f62dffe6" +content_hash = "sha256:04048cfc11c6fa5725f09144f4fb6db0dce59883549d089b0aa31e8b6e9212b3" [[package]] name = "aiofiles" @@ -32,35 +32,6 @@ files = [ {file = "anyio-4.0.0.tar.gz", hash = "sha256:f7ed51751b2c2add651e5747c891b47e26d2a21be5d32d9311dfe9692f3e5d7a"}, ] -[[package]] -name = "apscheduler" -version = "3.10.4" -requires_python = ">=3.6" -summary = "In-process task scheduler with Cron-like capabilities" -dependencies = [ - "pytz", - "six>=1.4.0", - "tzlocal!=3.*,>=2.0", -] -files = [ - {file = "APScheduler-3.10.4-py3-none-any.whl", hash = "sha256:fb91e8a768632a4756a585f79ec834e0e27aad5860bac7eaa523d9ccefd87661"}, - {file = "APScheduler-3.10.4.tar.gz", hash = "sha256:e6df071b27d9be898e486bc7940a7be50b4af2e9da7c08f0744a96d4bd4cef4a"}, -] - -[[package]] -name = "backports-zoneinfo" -version = "0.2.1" -requires_python = ">=3.6" -summary = "Backport of the standard library zoneinfo module" -files = [ - {file = "backports.zoneinfo-0.2.1-cp38-cp38-macosx_10_14_x86_64.whl", hash = "sha256:8961c0f32cd0336fb8e8ead11a1f8cd99ec07145ec2931122faaac1c8f7fd987"}, - {file = "backports.zoneinfo-0.2.1-cp38-cp38-manylinux1_i686.whl", hash = "sha256:e81b76cace8eda1fca50e345242ba977f9be6ae3945af8d46326d776b4cf78d1"}, - {file = "backports.zoneinfo-0.2.1-cp38-cp38-manylinux1_x86_64.whl", hash = "sha256:7b0a64cda4145548fed9efc10322770f929b944ce5cee6c0dfe0c87bf4c0c8c9"}, - {file = "backports.zoneinfo-0.2.1-cp38-cp38-win32.whl", hash = "sha256:1b13e654a55cd45672cb54ed12148cd33628f672548f373963b0bff67b217328"}, - {file = "backports.zoneinfo-0.2.1-cp38-cp38-win_amd64.whl", hash = "sha256:4a0f800587060bf8880f954dbef70de6c11bbe59c673c3d818921f042f9954a6"}, - {file = "backports.zoneinfo-0.2.1.tar.gz", hash = "sha256:fadbfe37f74051d024037f223b8e001611eac868b5c5b06144ef4d8b799862f2"}, -] - [[package]] name = "bbcode" version = "1.1.0" @@ -835,20 +806,6 @@ files = [ {file = "nonebot_adapter_onebot-2.3.0.tar.gz", hash = "sha256:417946698b4d82a3227cea55573085772b911c4cb27ee5515f7306dbb14ef2e0"}, ] -[[package]] -name = "nonebot-plugin-apscheduler" -version = "0.3.0" -requires_python = ">=3.8,<4.0" -summary = "APScheduler Support for NoneBot2" -dependencies = [ - "apscheduler<4.0.0,>=3.7.0", - "nonebot2<3.0.0,>=2.0.0", -] -files = [ - {file = "nonebot_plugin_apscheduler-0.3.0-py3-none-any.whl", hash = "sha256:ec5e0267293fc9803e543c6086d3e109ac87bf6dccea5473d219cad826238aae"}, - {file = "nonebot_plugin_apscheduler-0.3.0.tar.gz", hash = "sha256:7c41cc1d49ea6af7c4518c72cd15f8c2f549071b8bc8bfc4b21fbdd0a4875cfd"}, -] - [[package]] name = "nonebot-plugin-htmlrender" version = "0.2.2" @@ -889,7 +846,7 @@ files = [ [[package]] name = "nonebot2" -version = "2.1.2" +version = "2.1.3" requires_python = ">=3.8,<4.0" summary = "An asynchronous python bot framework." dependencies = [ @@ -901,8 +858,8 @@ dependencies = [ "yarl<2.0.0,>=1.7.2", ] files = [ - {file = "nonebot2-2.1.2-py3-none-any.whl", hash = "sha256:a4df78e4c8b81773ea70b4b68d4ac3a5027d69517661d756772f11edf3cd3b1f"}, - {file = "nonebot2-2.1.2.tar.gz", hash = "sha256:afb3c141c67645cd038125287d0583aec2220eca998a8392e42ba87722f6659f"}, + {file = "nonebot2-2.1.3-py3-none-any.whl", hash = "sha256:c36c1a60ce4355d9777fee431c08619f22ffd60f7060993fbbbd1fe67b6368f7"}, + {file = "nonebot2-2.1.3.tar.gz", hash = "sha256:e750e615f1ad2503721ce055fbe55ec3b061277135d995be112fecd27f7232e5"}, ] [[package]] @@ -1268,15 +1225,6 @@ files = [ {file = "python_markdown_math-0.8-py3-none-any.whl", hash = "sha256:c685249d84b5b697e9114d7beb352bd8ca2e07fd268fd4057ffca888c14641e5"}, ] -[[package]] -name = "pytz" -version = "2023.3.post1" -summary = "World timezone definitions, modern and historical" -files = [ - {file = "pytz-2023.3.post1-py2.py3-none-any.whl", hash = "sha256:ce42d816b81b68506614c11e8937d3aa9e41007ceb50bfdcb0749b921bf646c7"}, - {file = "pytz-2023.3.post1.tar.gz", hash = "sha256:7b4fddbeb94a1eba4b557da24f19fdf9db575192544270a9101d8509f9f43d7b"}, -] - [[package]] name = "pyyaml" version = "6.0.1" @@ -1379,30 +1327,6 @@ files = [ {file = "typing_extensions-4.8.0.tar.gz", hash = "sha256:df8e4339e9cb77357558cbdbceca33c303714cf861d1eef15e1070055ae8b7ef"}, ] -[[package]] -name = "tzdata" -version = "2023.3" -requires_python = ">=2" -summary = "Provider of IANA time zone data" -files = [ - {file = "tzdata-2023.3-py2.py3-none-any.whl", hash = "sha256:7e65763eef3120314099b6939b5546db7adce1e7d6f2e179e3df563c70511eda"}, - {file = "tzdata-2023.3.tar.gz", hash = "sha256:11ef1e08e54acb0d4f95bdb1be05da659673de4acbd21bf9c69e94cc5e907a3a"}, -] - -[[package]] -name = "tzlocal" -version = "5.0.1" -requires_python = ">=3.7" -summary = "tzinfo object for the local timezone" -dependencies = [ - "backports-zoneinfo; python_version < \"3.9\"", - "tzdata; platform_system == \"Windows\"", -] -files = [ - {file = "tzlocal-5.0.1-py3-none-any.whl", hash = "sha256:f3596e180296aaf2dbd97d124fe76ae3a0e3d32b258447de7b939b3fd4be992f"}, - {file = "tzlocal-5.0.1.tar.gz", hash = "sha256:46eb99ad4bdb71f3f72b7d24f4267753e240944ecfc16f25d2719ba89827a803"}, -] - [[package]] name = "urllib3" version = "2.0.6"