├── 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 |
6 | 7 |