├── pyproject.toml ├── .github └── workflows │ └── pypi-publish.yml ├── nonebot_plugin_alipayvoice └── __init__.py ├── LICENSE └── README.md /pyproject.toml: -------------------------------------------------------------------------------- 1 | [project] 2 | name = "nonebot-plugin-alipayvoice" 3 | version = "0.5.0" 4 | description = "An alipay voice plugin for NoneBot2" 5 | authors = [ 6 | {name = "Akirami", email = "Akiramiaya@outlook.com"}, 7 | ] 8 | license-expression = "MIT" 9 | dependencies = ["nonebot2>=2.0.0b2", "nonebot-adapter-onebot>=2.0.0b1", "cn2an>=0.5.17"] 10 | requires-python = ">=3.8" 11 | readme = "README.md" 12 | 13 | [project.urls] 14 | Homepage = "https://github.com/A-kirami/nonebot-plugin-alipayvoice" 15 | Repository = "https://github.com/A-kirami/nonebot-plugin-alipayvoice" 16 | 17 | [build-system] 18 | requires = ["pdm-pep517>=0.12.0"] 19 | build-backend = "pdm.pep517.api" 20 | -------------------------------------------------------------------------------- /.github/workflows/pypi-publish.yml: -------------------------------------------------------------------------------- 1 | name: Publish Python 🐍 distributions 📦 to PyPI 2 | 3 | on: push 4 | 5 | jobs: 6 | build-n-publish: 7 | name: Build and publish Python 🐍 distributions 📦 to PyPI 8 | runs-on: ubuntu-20.04 9 | steps: 10 | - uses: actions/checkout@master 11 | - name: Set up Python 3.8 12 | uses: actions/setup-python@v1 13 | with: 14 | python-version: 3.8 15 | - name: Install pypa/build 16 | run: >- 17 | python -m 18 | pip install 19 | build 20 | --user 21 | - name: Build a binary wheel and a source tarball 22 | run: >- 23 | python -m 24 | build 25 | --sdist 26 | --wheel 27 | --outdir dist/ 28 | . 29 | - name: Publish distribution 📦 to PyPI 30 | if: startsWith(github.ref, 'refs/tags') 31 | uses: pypa/gh-action-pypi-publish@master 32 | with: 33 | password: ${{ secrets.PYPI_API_TOKEN }} -------------------------------------------------------------------------------- /nonebot_plugin_alipayvoice/__init__.py: -------------------------------------------------------------------------------- 1 | import cn2an 2 | from nonebot import on_command 3 | from nonebot.adapters.onebot.v11 import Message, MessageSegment 4 | from nonebot.matcher import Matcher 5 | from nonebot.params import CommandArg 6 | 7 | alipay_voice = on_command("支付宝到账", aliases={"支付宝语音"}) 8 | 9 | 10 | @alipay_voice.handle() 11 | async def alipay(matcher: Matcher, args: Message = CommandArg()): 12 | amount = args.extract_plain_text().replace("元", "") 13 | if not amount: 14 | return 15 | if not amount.isdigit(): 16 | try: 17 | amount = cn2an.cn2an(amount, "smart") 18 | except Exception: 19 | await matcher.send("错误的,请输入正确的数字") 20 | if 0.01 <= float(amount) <= 999999999999.99: 21 | url = f"https://mm.cqu.cc/share/zhifubaodaozhang/mp3/{amount}.mp3" 22 | await matcher.send(MessageSegment.record(url)) 23 | else: 24 | await matcher.send("数字大小超出限制,支持范围为0.01~999999999999.99") 25 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2022 Akirami 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 |
2 | NoneBotPluginLogo 3 |
4 |

NoneBotPluginText

5 |
6 | 7 |
8 | 9 | # nonebot-plugin-alipayvoice 10 | 11 | _✨ 支付宝到账0.5元( ✨_ 12 | 13 | 14 | 15 | license 16 | 17 | 18 | pypi 19 | 20 | python 21 | 22 |
23 | 24 | ## 📖 介绍 25 | 26 | 发送支付宝到账语音, 支持金额范围为0.01~999999999999.99 27 | 28 | ## 💿 安装 29 | 30 |
31 | 使用 nb-cli 安装 32 | 在 nonebot2 项目的根目录下打开命令行, 输入以下指令即可安装 33 | 34 | nb plugin install nonebot-plugin-alipayvoice 35 | 36 |
37 | 38 |
39 | 使用包管理器安装 40 | 在 nonebot2 项目的插件目录下, 打开命令行, 根据你使用的包管理器, 输入相应的安装命令 41 | 42 |
43 | pip 44 | 45 | pip install nonebot-plugin-alipayvoice 46 |
47 |
48 | pdm 49 | 50 | pdm add nonebot-plugin-alipayvoice 51 |
52 |
53 | poetry 54 | 55 | poetry add nonebot-plugin-alipayvoice 56 |
57 |
58 | conda 59 | 60 | conda install nonebot-plugin-alipayvoice 61 |
62 | 63 | 打开 nonebot2 项目的 `bot.py` 文件, 在其中写入 64 | 65 | nonebot.load_plugin('nonebot_plugin_alipayvoice') 66 | 67 |
68 | 69 | 70 | ## 🎉 使用 71 | ### 指令表 72 | | 指令 | 说明 | 73 | |:-----:|:----:| 74 | | 支付宝到账 + 金额 | 发送对应金额到账的支付宝语音 | 75 | 76 | --------------------------------------------------------------------------------