# -*- coding: utf-8 -*-
from setuptools import setup

packages = \
['ayaka']

package_data = \
{'': ['*']}

install_requires = \
['nonebot-adapter-onebot>=2.1.3,<3.0.0',
 'nonebot2>=2.0.0b5,<3.0.0',
 'playwright>=1.27.1,<2.0.0']

setup_kwargs = {
    'name': 'nonebot-plugin-ayaka',
    'version': '0.3.2',
    'description': 'a useful plugin providing convinient tools for the development of textual game on QQ',
    'long_description': '# Ayaka 0.3.2\n针对Nonebot2框架 Onebot_v11协议的文字游戏开发辅助插件\n\n<img src="https://img.shields.io/badge/python-3.8%2B-blue">\n\n<b>注意：由于更新pypi的readme.md需要占用版本号，因此其readme.md可能不是最新的，强烈建议读者前往[github仓库](https://github.com/bridgeL/nonebot-plugin-ayaka)以获取最新版本的帮助</b>\n\n\n# 更新记录\n\n<details>\n<summary>更新记录</summary>\n\n| 版本  | 备注 |\n| - | - |\n| 0.3.0 | 借助contextvar内置模块，全部重写了之间的代码，现在它们被合并为一个单文件，并能实现ayaka插件先前提供的所有功能，但不幸的是，其无法兼容0.2.x的ayaka插件，需要代码迁移 |\n| 0.3.1 | 规定了应用启动后的默认初始状态为 init |\n| 0.3.2 | 增加了较为完善的注释 |\n\n\n</details>\n\n# 安装\n`pip install nonebot-plugin-ayaka` \n\n无需修改`bot.py`，在ayaka衍生插件里引用即可，`from ayaka import AyakaApp`\n\n但是ayaka衍生插件需要nonebot来加载\n\n# 快速了解\n\n通过ayaka插件，二次封装nonebot2提供的api，提供专用api，便于其他文字游戏插件的编写\n\n## 基本特性\n- 状态机\n- 命令隔离\n- 数据隔离\n\n## 插件编写范例 echo\n\n```python\n\'\'\'\n    具有状态机的复读模块\n\'\'\'\nfrom ayaka import AyakaApp\n\napp = AyakaApp("echo")\n\n# 结合ayaka_master插件，用户可通过#help命令展示app.help\napp.help = \'\'\'复读只因\n特殊命令一览：\n- reverse 开始说反话\n- back 停止说反话\n- exit 退出\n\'\'\'\n\n# 另一种写法\napp.help = {\n    "init": "复读只因\\n特殊命令一览：\\n- reverse 开始说反话\\n- exit 退出",\n    "reverse": "说反话模式\\n- back 停止说反话"\n}\n\n\n# 桌面状态下\n@app.on_command("echo")\nasync def app_entrance():\n    if app.args:\n        await app.send(" ".join(str(arg) for arg in app.args))\n        return\n\n    # 没有输入参数则运行该应用\n    await app.start()\n\n\n# app运行后，进入初始状态(state = "init")\n\n# 正常复读\n@app.on_state_text()\nasync def repeat():\n    await app.send(app.message)\n\n\n# 任意状态均可直接退出\n@app.on_state_command(["exit", "退出"], "*")\nasync def app_exit():\n    await app.close()\n\n\n# 通过命令，跳转到reverse状态\n@app.on_state_command(["rev", "reverse", "话反说", "反", "说反话"])\nasync def start_rev():\n    app.set_state("reverse")\n    await app.send("开始说反话")\n\n\n# 反向复读\n@app.on_state_text("reverse")\nasync def reverse_echo():\n    msg = str(app.message)\n    msg = "".join(s for s in reversed(msg))\n    await app.send(msg)\n\n\n# 通过命令，跳转回初始状态\n@app.on_state_command("back", "reverse")\nasync def back():\n    app.set_state()\n    await app.send("话反说止停")\n\n```\n\n\n## 插件编写范例 hello world\n\n```python\n\n\'\'\'\n    ayaka可以帮助你实现命令隔离\n\'\'\'\nfrom ayaka import AyakaApp\n\napp = AyakaApp("hello-world")\n\n# 你可以不写帮助\n# app.help\n\n\n# 桌面状态下\n@app.on_command("hw")\nasync def app_entrance():\n    await app.start()\n    # app运行后，进入指定状态(state = "world")\n    app.set_state("world")\n\n\n# 只有world状态可以退出，其他状态运行该指令均为返回world状态\n@app.on_state_command(["exit", "退出"], "*")\nasync def app_exit():\n    if app.state == "world":\n        await app.close()\n    else:\n        app.set_state("world")\n        await app.send("跳转到 world")\n\n\n# 对世界、月亮和太阳打个招呼\n@app.on_state_command("hi", ["world", "moon", "sun"])\nasync def hello():\n    await app.send(f"hello,{app.state}!")\n\n\n# 对世界、月亮和太阳来个大比兜\n@app.on_state_command("hit", "world")\nasync def hit():\n    await app.send("earthquake")\n\n\n@app.on_state_command("hit", "moon")\nasync def hit():\n    await app.send("moon fall")\n\n\n@app.on_state_command("hit", "sun")\nasync def hit():\n    await app.send("bag bang!")\n\n\n# 跳转状态\n@app.on_state_command("jump", "*")\nasync def jump_to_somewhere():\n    if not app.args:\n        await app.send("没有参数！")\n    else:\n        next_state = str(app.args[0])\n        app.set_state(next_state)\n        await app.send(f"跳转到 [{next_state}]")\n```\n\n## 插件编写范例 a plus b\n\n```python\n\'\'\'\n    a + b 各群聊间、各插件间，数据独立，互不影响\n\'\'\'\nfrom ayaka import AyakaApp\n\napp = AyakaApp("a-plus-b")\n\n\n@app.on_command("set_a")\nasync def set_a():\n    app.cache.a = int(str(app.args[0])) if app.args else 0\n    await app.send(app.cache.a)\n\n\n@app.on_command("set_b")\nasync def set_b():\n    app.cache.b = int(str(app.args[0])) if app.args else 0\n    await app.send(app.cache.b)\n\n\n@app.on_command("calc")\nasync def calc():\n    a = app.cache.a or 0\n    b = app.cache.b or 0\n    await app.send(str(a+b))\n```\n\n# 更多特性\n\n## 定时器 Timer\n\n注意，定时器触发回调时，由于缺乏消息激励源，app的大部分属性(bot、group、event、valid、cache、user_name等)将无法正确访问到，并且无法使用app.send方法，需要使用专用的t_send方法\n\n```python\n\'\'\'\n    整点报时\n\'\'\'\nfrom ayaka import AyakaApp\n\napp = AyakaApp("整点报时")\n\n\n@app.on_interval(60, s=0)\nasync def every_minute():\n    await app.t_send(bot_id=2317709898, group_id=666214666, message="小乐")\n\n\n@app.on_interval(3600, m=0, s=0)\nasync def every_hour():\n    await app.t_send(bot_id=2317709898, group_id=666214666, message="大乐")\n\n\n@app.on_everyday(h=23, m=59, s=59)\nasync def every_day():\n    await app.t_send(bot_id=2317709898, group_id=666214666, message="呃呃呃一天要结束了")\n\n```\n\n## 截图 playwright\n\n注意，win平台使用playwright + nb时需要关闭fastapi的reload功能\n\n```python\n\n\'\'\'\n    can can baidu\n\'\'\'\n\nfrom pathlib import Path\nfrom ayaka import get_new_page, AyakaApp, MessageSegment\n\napp = AyakaApp("看看baidu")\n\n\n@app.on_command("ccb")\nasync def _():\n    async with get_new_page() as p:\n        await p.goto("http://www.baidu.com", wait_until="networkidle")\n        path = Path("test.png").absolute()\n        await p.screenshot(path=path)\n    image = MessageSegment.image(path)\n    await app.send(image)\n\n```\n\n# 未来计划\n提供aiosqlite数据库支持\n',
    'author': 'Su',
    'author_email': 'wxlxy316@163.com',
    'maintainer': 'None',
    'maintainer_email': 'None',
    'url': 'https://github.com/bridgeL/nonebot-plugin-ayaka',
    'packages': packages,
    'package_data': package_data,
    'install_requires': install_requires,
    'python_requires': '>=3.8,<4.0',
}


setup(**setup_kwargs)
