nonebot_plugin_web_bottle


Namenonebot_plugin_web_bottle JSON
Version 1.3.0 PyPI version JSON
download
home_pageNone
Summary有web的漂流瓶
upload_time2024-12-15 05:51:17
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <!-- markdownlint-disable MD033 MD036 MD041  -->
<div align="center">
  <a href="https://v2.nonebot.dev/store">
    <img src="./img/NoneBotPlugin.png" width="300" alt="logo" />
  </a>


# nonebot_plugin_web_bottle
![Python](https://img.shields.io/badge/Python-3.11+-blue.svg)
![PyPI - Version](https://img.shields.io/pypi/v/nonebot-plugin-web-bottle)
[![pdm-managed](https://img.shields.io/endpoint?url=https%3A%2F%2Fcdn.jsdelivr.net%2Fgh%2Fpdm-project%2F.github%2Fbadge.json)](https://pdm-project.org)

✨一个基于nonebot2与onebotv11 使用fastapi驱动的漂流瓶插件,有一个简单的web用于审核用户提交的漂流瓶✨


</div>


# 如何安装?
(建议使用pip下载后手动在github页面下载源代码并将插件放入插件目录中以使用最新的更改)
**Pypi**
```bash
pip install nonebot-plugin-web-bottle
```

**Nonebot**
```bash
nb plugin install nonebot-plugin-web-bottle
```

# 目前实现了什么?
- [x] 在QQ内
- [x] 丢瓶子
- [x] 捡瓶子
- [x] 评论漂流瓶 [编号] [评论内容]
- [x] 点赞漂流瓶 [编号]
- [x] 在网页端
- [x] 审核漂流瓶
- [x] 审核评论
- [x] 登录验证

# 效果图:
![Image of Yaktocat](https://raw.githubusercontent.com/luosheng520qaq/nonebot-plugin-web-bottle/refs/heads/master/B66FEE6EE4B550CF930CF48FFB9EDC0D.png)
![Image of Yaktocat](https://github.com/luosheng520qaq/nonebot_plugin_web_bottle/blob/master/example/bottles.png)
![Image of Yaktocat](https://github.com/luosheng520qaq/nonebot_plugin_web_bottle/blob/master/example/comments.png)
# 关于插件的其他注意事项
## 存储位置
本插件使用商店的 plugin-localstore(https://github.com/nonebot/plugin-localstore)
默认存储地址请前往其文档查看。
可以自己配置到机器人主目录,方便后续随时查看
```
localstore_cache_dir=   
localstore_config_dir=
localstore_data_dir=
```
在这个插件里,你通常只需要配置修改 localstore_data_dir=  即可

## 建议nonebot配置
如果想要在其他机器上访问到审核web,请修改nonebot运行的IP,在配置文件中修改如下:

```
HOST=0.0.0.0
```

## web页面地址:
```
http://location:nonebot端口/login 登录页面
http://location:nonebot端口/check 漂流瓶审核
http://location:nonebot端口/comments 评论审核

或者将location替换为nonebot所在机器的IPv4地址
```
## 背景图片
位于:
```
插件目录\templates\static\images
```
可自行修改,修改时请修改相应的webp图片
## 关于漂流瓶配置选项:
为防止过多读取时内存占用过高,一个瓶子内最多允许有两张图片,如果需要更多,请在nonebot配置项写入 

以下配置为插件默认值,如果您认为不需要修改,可以不添加
```
# 网页相关
默认登录密钥
bottle_account = 'admin'
bottle_password = 'password'
expire_time=12  # 登录态过期时间(单位:小时)
gzip_level=9    # gzip压缩等级(一般情况无需修改)


# 丢瓶子规则配置
max_bottle_pic=2    # 丢瓶子允许最多图片数量
max_bottle_liens=9  # 丢瓶子允许最多文字行数
max_bottle_word=1200    # 丢瓶子允许最多字符数量
embedded_help=True  # 开启后,丢瓶子时未添加任何内容,则返回指令帮助

# 瓶子评论区规则配置
default_nickname="未知昵称" # 定义获取昵称失败时对评论区用户默认称呼
bottle_msg_split=True   # 分离瓶子和评论区为两条独立消息
max_bottle_comments=3   # 捡瓶子最多展示评论条数

# 适配官方Bot或提升响应速度
bottle_msg_uname=True   # 为False时关闭发送者昵称获取展示 适用于官方Bot或想要提高响应速度时
bottle_msg_gname=True   # 为False时关闭群聊昵称获取展示 同上
qq_markdown=False   # QQMD适配,请自行申请并修改to_msg.py中的模板

```

官方bot仅试过使用 [Gensokyo](https://github.com/Hoshinonyaruko/Gensokyo) 正常运行,野生机器人推荐使用NapCat,LLOneBot ,Lagrange 等

以下是适合本项目的markdown模板和实际效果展示,你需要在QQ开放平台>bot>开发>高阶能力下进行申请,过审后将平台分配的模板ID填写在本项目的tomsg.py模块中(此外,涉及模板图片和头像获取转换,您还需要参考Gensokyo接口文档,在本模块内填写所需IP和端口):
<table>
  <tr>
    <td>
      <img src="https://github.com/youlanan/nonebot-plugin-web-bottle/blob/master/example/md02.png" width="240" height="160">
      <br>瓶子本体
    </td>
    <td rowspan="2"><img src="https://github.com/youlanan/nonebot-plugin-web-bottle/blob/master/example/md03.jpg" width="240" height="480"></td>
  </tr>
  <tr>
    <td>
      <img src="https://github.com/youlanan/nonebot-plugin-web-bottle/blob/master/example/md01.png" width="240" height="240">
      <br>评论区
    </td>
  </tr>
</table>




# 未来计划
- [x] 提交至nonebot商店 
- [x] 修改漂流瓶投掷者输出方式为 QQ昵称 与 群昵称(已经编写 具体适配情况取决于你的协议端)
- [x] 针对使用QQ开放平台BOT的场景进行调整(支持Gensokyo项目的适配)
- [x] 增加登录验证
- [ ] 新增提醒
- [ ] 美化页面 (等几百年后我学会css再说吧)
- [ ] 优化性能

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "nonebot_plugin_web_bottle",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Xican <723926109@qq.com>",
    "download_url": "https://files.pythonhosted.org/packages/c6/97/731b8cc51ea06b8e17a7fa4af78bffee8314c981c6e6e19e9ef4926155ef/nonebot_plugin_web_bottle-1.3.0.tar.gz",
    "platform": null,
    "description": "<!-- markdownlint-disable MD033 MD036 MD041  -->\n<div align=\"center\">\n  <a href=\"https://v2.nonebot.dev/store\">\n    <img src=\"./img/NoneBotPlugin.png\" width=\"300\" alt=\"logo\" />\n  </a>\n\n\n# nonebot_plugin_web_bottle\n![Python](https://img.shields.io/badge/Python-3.11+-blue.svg)\n![PyPI - Version](https://img.shields.io/pypi/v/nonebot-plugin-web-bottle)\n[![pdm-managed](https://img.shields.io/endpoint?url=https%3A%2F%2Fcdn.jsdelivr.net%2Fgh%2Fpdm-project%2F.github%2Fbadge.json)](https://pdm-project.org)\n\n\u2728\u4e00\u4e2a\u57fa\u4e8enonebot2\u4e0eonebotv11 \u4f7f\u7528fastapi\u9a71\u52a8\u7684\u6f02\u6d41\u74f6\u63d2\u4ef6\uff0c\u6709\u4e00\u4e2a\u7b80\u5355\u7684web\u7528\u4e8e\u5ba1\u6838\u7528\u6237\u63d0\u4ea4\u7684\u6f02\u6d41\u74f6\u2728\n\n\n</div>\n\n\n# \u5982\u4f55\u5b89\u88c5\uff1f\n\uff08\u5efa\u8bae\u4f7f\u7528pip\u4e0b\u8f7d\u540e\u624b\u52a8\u5728github\u9875\u9762\u4e0b\u8f7d\u6e90\u4ee3\u7801\u5e76\u5c06\u63d2\u4ef6\u653e\u5165\u63d2\u4ef6\u76ee\u5f55\u4e2d\u4ee5\u4f7f\u7528\u6700\u65b0\u7684\u66f4\u6539\uff09\n**Pypi**\n```bash\npip install nonebot-plugin-web-bottle\n```\n\n**Nonebot**\n```bash\nnb plugin install nonebot-plugin-web-bottle\n```\n\n# \u76ee\u524d\u5b9e\u73b0\u4e86\u4ec0\u4e48\uff1f\n- [x] \u5728QQ\u5185\n- [x] \u4e22\u74f6\u5b50\n- [x] \u6361\u74f6\u5b50\n- [x] \u8bc4\u8bba\u6f02\u6d41\u74f6 [\u7f16\u53f7] [\u8bc4\u8bba\u5185\u5bb9]\n- [x] \u70b9\u8d5e\u6f02\u6d41\u74f6 [\u7f16\u53f7]\n- [x] \u5728\u7f51\u9875\u7aef\n- [x] \u5ba1\u6838\u6f02\u6d41\u74f6\n- [x] \u5ba1\u6838\u8bc4\u8bba\n- [x] \u767b\u5f55\u9a8c\u8bc1\n\n# \u6548\u679c\u56fe\uff1a\n![Image of Yaktocat](https://raw.githubusercontent.com/luosheng520qaq/nonebot-plugin-web-bottle/refs/heads/master/B66FEE6EE4B550CF930CF48FFB9EDC0D.png)\n![Image of Yaktocat](https://github.com/luosheng520qaq/nonebot_plugin_web_bottle/blob/master/example/bottles.png)\n![Image of Yaktocat](https://github.com/luosheng520qaq/nonebot_plugin_web_bottle/blob/master/example/comments.png)\n# \u5173\u4e8e\u63d2\u4ef6\u7684\u5176\u4ed6\u6ce8\u610f\u4e8b\u9879\n## \u5b58\u50a8\u4f4d\u7f6e\n\u672c\u63d2\u4ef6\u4f7f\u7528\u5546\u5e97\u7684 plugin-localstore(https://github.com/nonebot/plugin-localstore)\n\u9ed8\u8ba4\u5b58\u50a8\u5730\u5740\u8bf7\u524d\u5f80\u5176\u6587\u6863\u67e5\u770b\u3002\n\u53ef\u4ee5\u81ea\u5df1\u914d\u7f6e\u5230\u673a\u5668\u4eba\u4e3b\u76ee\u5f55\uff0c\u65b9\u4fbf\u540e\u7eed\u968f\u65f6\u67e5\u770b\n```\nlocalstore_cache_dir=   \nlocalstore_config_dir=\nlocalstore_data_dir=\n```\n\u5728\u8fd9\u4e2a\u63d2\u4ef6\u91cc\uff0c\u4f60\u901a\u5e38\u53ea\u9700\u8981\u914d\u7f6e\u4fee\u6539 localstore_data_dir=  \u5373\u53ef\n\n## \u5efa\u8baenonebot\u914d\u7f6e\n\u5982\u679c\u60f3\u8981\u5728\u5176\u4ed6\u673a\u5668\u4e0a\u8bbf\u95ee\u5230\u5ba1\u6838web\uff0c\u8bf7\u4fee\u6539nonebot\u8fd0\u884c\u7684IP\uff0c\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\u4fee\u6539\u5982\u4e0b\uff1a\n\n```\nHOST=0.0.0.0\n```\n\n## web\u9875\u9762\u5730\u5740\uff1a\n```\nhttp://location:nonebot\u7aef\u53e3/login \u767b\u5f55\u9875\u9762\nhttp://location:nonebot\u7aef\u53e3/check \u6f02\u6d41\u74f6\u5ba1\u6838\nhttp://location:nonebot\u7aef\u53e3/comments \u8bc4\u8bba\u5ba1\u6838\n\n\u6216\u8005\u5c06location\u66ff\u6362\u4e3anonebot\u6240\u5728\u673a\u5668\u7684IPv4\u5730\u5740\n```\n## \u80cc\u666f\u56fe\u7247\n\u4f4d\u4e8e\uff1a\n```\n\u63d2\u4ef6\u76ee\u5f55\\templates\\static\\images\n```\n\u53ef\u81ea\u884c\u4fee\u6539\uff0c\u4fee\u6539\u65f6\u8bf7\u4fee\u6539\u76f8\u5e94\u7684webp\u56fe\u7247\n## \u5173\u4e8e\u6f02\u6d41\u74f6\u914d\u7f6e\u9009\u9879\uff1a\n\u4e3a\u9632\u6b62\u8fc7\u591a\u8bfb\u53d6\u65f6\u5185\u5b58\u5360\u7528\u8fc7\u9ad8\uff0c\u4e00\u4e2a\u74f6\u5b50\u5185\u6700\u591a\u5141\u8bb8\u6709\u4e24\u5f20\u56fe\u7247\uff0c\u5982\u679c\u9700\u8981\u66f4\u591a\uff0c\u8bf7\u5728nonebot\u914d\u7f6e\u9879\u5199\u5165 \n\n\u4ee5\u4e0b\u914d\u7f6e\u4e3a\u63d2\u4ef6\u9ed8\u8ba4\u503c\uff0c\u5982\u679c\u60a8\u8ba4\u4e3a\u4e0d\u9700\u8981\u4fee\u6539\uff0c\u53ef\u4ee5\u4e0d\u6dfb\u52a0\n```\n# \u7f51\u9875\u76f8\u5173\n\u9ed8\u8ba4\u767b\u5f55\u5bc6\u94a5\nbottle_account = 'admin'\nbottle_password = 'password'\nexpire_time=12  # \u767b\u5f55\u6001\u8fc7\u671f\u65f6\u95f4\uff08\u5355\u4f4d\uff1a\u5c0f\u65f6\uff09\ngzip_level=9    # gzip\u538b\u7f29\u7b49\u7ea7\uff08\u4e00\u822c\u60c5\u51b5\u65e0\u9700\u4fee\u6539\uff09\n\n\n# \u4e22\u74f6\u5b50\u89c4\u5219\u914d\u7f6e\nmax_bottle_pic=2    # \u4e22\u74f6\u5b50\u5141\u8bb8\u6700\u591a\u56fe\u7247\u6570\u91cf\nmax_bottle_liens=9  # \u4e22\u74f6\u5b50\u5141\u8bb8\u6700\u591a\u6587\u5b57\u884c\u6570\nmax_bottle_word=1200    # \u4e22\u74f6\u5b50\u5141\u8bb8\u6700\u591a\u5b57\u7b26\u6570\u91cf\nembedded_help=True  # \u5f00\u542f\u540e\uff0c\u4e22\u74f6\u5b50\u65f6\u672a\u6dfb\u52a0\u4efb\u4f55\u5185\u5bb9\uff0c\u5219\u8fd4\u56de\u6307\u4ee4\u5e2e\u52a9\n\n# \u74f6\u5b50\u8bc4\u8bba\u533a\u89c4\u5219\u914d\u7f6e\ndefault_nickname=\"\u672a\u77e5\u6635\u79f0\" # \u5b9a\u4e49\u83b7\u53d6\u6635\u79f0\u5931\u8d25\u65f6\u5bf9\u8bc4\u8bba\u533a\u7528\u6237\u9ed8\u8ba4\u79f0\u547c\nbottle_msg_split=True   # \u5206\u79bb\u74f6\u5b50\u548c\u8bc4\u8bba\u533a\u4e3a\u4e24\u6761\u72ec\u7acb\u6d88\u606f\nmax_bottle_comments=3   # \u6361\u74f6\u5b50\u6700\u591a\u5c55\u793a\u8bc4\u8bba\u6761\u6570\n\n# \u9002\u914d\u5b98\u65b9Bot\u6216\u63d0\u5347\u54cd\u5e94\u901f\u5ea6\nbottle_msg_uname=True   # \u4e3aFalse\u65f6\u5173\u95ed\u53d1\u9001\u8005\u6635\u79f0\u83b7\u53d6\u5c55\u793a \u9002\u7528\u4e8e\u5b98\u65b9Bot\u6216\u60f3\u8981\u63d0\u9ad8\u54cd\u5e94\u901f\u5ea6\u65f6\nbottle_msg_gname=True   # \u4e3aFalse\u65f6\u5173\u95ed\u7fa4\u804a\u6635\u79f0\u83b7\u53d6\u5c55\u793a \u540c\u4e0a\nqq_markdown=False   # QQMD\u9002\u914d\uff0c\u8bf7\u81ea\u884c\u7533\u8bf7\u5e76\u4fee\u6539to_msg.py\u4e2d\u7684\u6a21\u677f\n\n```\n\n\u5b98\u65b9bot\u4ec5\u8bd5\u8fc7\u4f7f\u7528 [Gensokyo](https://github.com/Hoshinonyaruko/Gensokyo) \u6b63\u5e38\u8fd0\u884c\uff0c\u91ce\u751f\u673a\u5668\u4eba\u63a8\u8350\u4f7f\u7528NapCat\uff0cLLOneBot ,Lagrange \u7b49\n\n\u4ee5\u4e0b\u662f\u9002\u5408\u672c\u9879\u76ee\u7684markdown\u6a21\u677f\u548c\u5b9e\u9645\u6548\u679c\u5c55\u793a\uff0c\u4f60\u9700\u8981\u5728QQ\u5f00\u653e\u5e73\u53f0>bot>\u5f00\u53d1>\u9ad8\u9636\u80fd\u529b\u4e0b\u8fdb\u884c\u7533\u8bf7\uff0c\u8fc7\u5ba1\u540e\u5c06\u5e73\u53f0\u5206\u914d\u7684\u6a21\u677fID\u586b\u5199\u5728\u672c\u9879\u76ee\u7684tomsg.py\u6a21\u5757\u4e2d\uff08\u6b64\u5916\uff0c\u6d89\u53ca\u6a21\u677f\u56fe\u7247\u548c\u5934\u50cf\u83b7\u53d6\u8f6c\u6362\uff0c\u60a8\u8fd8\u9700\u8981\u53c2\u8003Gensokyo\u63a5\u53e3\u6587\u6863\uff0c\u5728\u672c\u6a21\u5757\u5185\u586b\u5199\u6240\u9700IP\u548c\u7aef\u53e3\uff09\uff1a\n<table>\n  <tr>\n    <td>\n      <img src=\"https://github.com/youlanan/nonebot-plugin-web-bottle/blob/master/example/md02.png\" width=\"240\" height=\"160\">\n      <br>\u74f6\u5b50\u672c\u4f53\n    </td>\n    <td rowspan=\"2\"><img src=\"https://github.com/youlanan/nonebot-plugin-web-bottle/blob/master/example/md03.jpg\" width=\"240\" height=\"480\"></td>\n  </tr>\n  <tr>\n    <td>\n      <img src=\"https://github.com/youlanan/nonebot-plugin-web-bottle/blob/master/example/md01.png\" width=\"240\" height=\"240\">\n      <br>\u8bc4\u8bba\u533a\n    </td>\n  </tr>\n</table>\n\n\n\n\n# \u672a\u6765\u8ba1\u5212\n- [x] \u63d0\u4ea4\u81f3nonebot\u5546\u5e97 \n- [x] \u4fee\u6539\u6f02\u6d41\u74f6\u6295\u63b7\u8005\u8f93\u51fa\u65b9\u5f0f\u4e3a QQ\u6635\u79f0 \u4e0e \u7fa4\u6635\u79f0\uff08\u5df2\u7ecf\u7f16\u5199 \u5177\u4f53\u9002\u914d\u60c5\u51b5\u53d6\u51b3\u4e8e\u4f60\u7684\u534f\u8bae\u7aef\uff09\n- [x] \u9488\u5bf9\u4f7f\u7528QQ\u5f00\u653e\u5e73\u53f0BOT\u7684\u573a\u666f\u8fdb\u884c\u8c03\u6574\uff08\u652f\u6301Gensokyo\u9879\u76ee\u7684\u9002\u914d\uff09\n- [x] \u589e\u52a0\u767b\u5f55\u9a8c\u8bc1\n- [ ] \u65b0\u589e\u63d0\u9192\n- [ ] \u7f8e\u5316\u9875\u9762 \uff08\u7b49\u51e0\u767e\u5e74\u540e\u6211\u5b66\u4f1acss\u518d\u8bf4\u5427\uff09\n- [ ] \u4f18\u5316\u6027\u80fd\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "\u6709web\u7684\u6f02\u6d41\u74f6",
    "version": "1.3.0",
    "project_urls": {
        "homepage": "https://github.com/luosheng520qaq/nonebot-plugin-web-bottle/",
        "repository": "https://github.com/luosheng520qaq/nonebot-plugin-web-bottle/"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "57c1f61f611321aa98301f02984263765e3b35f4d8cd7fd022ab6c26178f4720",
                "md5": "cc04cd7455dc52e628b60cb0cd37c42b",
                "sha256": "0f4e72bf297ab540184df9fa381c29f20346b6ebc01bc415693a380591ecea46"
            },
            "downloads": -1,
            "filename": "nonebot_plugin_web_bottle-1.3.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "cc04cd7455dc52e628b60cb0cd37c42b",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 14038640,
            "upload_time": "2024-12-15T05:51:10",
            "upload_time_iso_8601": "2024-12-15T05:51:10.459114Z",
            "url": "https://files.pythonhosted.org/packages/57/c1/f61f611321aa98301f02984263765e3b35f4d8cd7fd022ab6c26178f4720/nonebot_plugin_web_bottle-1.3.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c697731b8cc51ea06b8e17a7fa4af78bffee8314c981c6e6e19e9ef4926155ef",
                "md5": "fdedf018f8852940f9e0627e7c241d9e",
                "sha256": "ab5a796da9e11578b8672b7b5f24ca33a7722665544aaa306e13f5deeb434dba"
            },
            "downloads": -1,
            "filename": "nonebot_plugin_web_bottle-1.3.0.tar.gz",
            "has_sig": false,
            "md5_digest": "fdedf018f8852940f9e0627e7c241d9e",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 14035713,
            "upload_time": "2024-12-15T05:51:17",
            "upload_time_iso_8601": "2024-12-15T05:51:17.058757Z",
            "url": "https://files.pythonhosted.org/packages/c6/97/731b8cc51ea06b8e17a7fa4af78bffee8314c981c6e6e19e9ef4926155ef/nonebot_plugin_web_bottle-1.3.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-12-15 05:51:17",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "luosheng520qaq",
    "github_project": "nonebot-plugin-web-bottle",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "lcname": "nonebot_plugin_web_bottle"
}
        
Elapsed time: 0.42140s