Merge remote-tracking branch 'nonebot2/nonebot2' into nonebot2

This commit is contained in:
CMHopeSunshine 2022-05-17 18:50:23 +08:00
commit 255ed578eb

217
README.md
View File

@ -1,96 +1,121 @@
# LittlePaimon_nb2 <p align="center" >
nonebot2版本的小派蒙 <a href="https://github.com/CMHopeSunshine/LittlePaimon/tree/nonebot2"><img src="https://cherishmoon.oss-cn-shenzhen.aliyuncs.com/LittlePaimon/readme/logo.png" width="256" height="256" alt="LittlePaimon"></a>
</p>
## 已完成迁移 <h1 align="center">小派蒙|LittlePaimon</h1>
- Paimon_Info 派蒙uid查询插件 <h4 align="center">✨基于<a href="https://github.com/Ice-Cirno/HoshinoBot" target="_blank">HoshinoBot</a>|<a href="https://github.com/nonebot/nonebot2" target="_blank">NoneBot2</a><a href="https://github.com/Mrs4s/go-cqhttp" target="_blank">go-cqhttp</a>的原神Q群机器人✨</h4>
- Paimon_Wiki 派蒙wiki查询插件
- Paimon_Gacha 派蒙模拟抽卡插件 <p align="center">
- Paimon_Gacha_Log 派蒙抽卡记录获取插件 <a href="https://cdn.jsdelivr.net/gh/CMHopeSunshine/LittlePaimon@master/LICENSE"><img src="https://img.shields.io/github/license/CMHopeSunshine/LittlePaimon" alt="license"></a>
- Paimon_Plugins 派蒙其他娱乐插件 <img src="https://img.shields.io/badge/Python-3.8+-yellow" alt="python">
* 对联 <a href="https://qun.qq.com/qqweb/qunpro/share?_wv=3&_wwv=128&inviteCode=MmWrI&from=246610&biz=ka"><img src="https://img.shields.io/badge/QQ频道交流-尘世闲游-green?style=flat-square" alt="QQ guild"></a>
* 来点猫片 </p>
* 来点二次元
* 来点原神壁纸 ## 简介
* 派蒙聊天(关键词触发)
原神多功能机器人通过米游社接口查询uid的游戏信息并提供WIKI查询和各种各样的好玩的功能。
具体插件命令与hoshino版一致<br>
nonebot2刚上手测试时间较短如有bug请及时反馈。 本README为NoneBot2版的介绍Hoshino版详见
+ [Github主页](https://github.com/CMHopeSunshine/LittlePaimon)
## 安装 + [README博客](https://blog.cherishmoon.fun/bot/LittlePaimon-hoshino.html)
> 已装nonebot2的只需看`安装插件`
### 1. 安装Git和Python3 ## 功能示例
不多说了看wiki的部署教程
<img src="https://cherishmoon.oss-cn-shenzhen.aliyuncs.com/LittlePaimon/readme/ys.jpg" alt="ys">
### 2. 安装nonebot2
先安装脚手架以及相关依赖 <details>
``` <summary>角色背包</summary>
pip install nb-cli <img src="https://cherishmoon.oss-cn-shenzhen.aliyuncs.com/LittlePaimon/readme/ysa.jpg" alt="ysa">
pip install matplotlib </details>
pip install aiohttp
pip install xlsxwriter <details>
``` <summary>角色详情</summary>
创建nonebot2项目 <img src="https://cherishmoon.oss-cn-shenzhen.aliyuncs.com/LittlePaimon/readme/ysc.jpg" alt="ysc">
`nb create` </details>
```
[?] Project Name: LittlePaimon <details>
名字随便填即可这里以LittlePaimon为例 <summary>深渊信息</summary>
[?] Where to store the plugin? <img src="https://cherishmoon.oss-cn-shenzhen.aliyuncs.com/LittlePaimon/readme/sy12.jpg" alt="sy">
> In a "genshinimpact_bot" folder </details>
> In a src folder
注:选择插件放置目录,键盘↑↓选择,回车确认,随便选 <details>
[?] Which builtin plugin(s) would you like to user? <summary>模拟抽卡</summary>
注:直接回车即可 <img src="https://cherishmoon.oss-cn-shenzhen.aliyuncs.com/LittlePaimon/readme/十连.jpg" alt="十连">
[?] which adapter(s) would you like to use? </details>
> ● OneBot V11
o 钉钉 <details>
o 飞书 <summary>实时便签</summary>
o Telegram <img src="https://cherishmoon.oss-cn-shenzhen.aliyuncs.com/LittlePaimon/readme/ssbq.jpg" alt="ssbq">
o QQ 频道 </details>
o 开黑啦
o mirai2 <details>
在第一个OneBot那里按空格然后回车 <summary>每月札记</summary>
``` <img src="https://cherishmoon.oss-cn-shenzhen.aliyuncs.com/LittlePaimon/readme/myzj.jpg" alt="myzj">
`cd LittlePaimon`进入刚刚创建的nb2项目<br> </details>
编辑`.env`,把`dev`改成`prod`<br>
编辑`.env.prod`,修改以下内容 <details>
``` <summary>角色材料</summary>
HOST=127.0.0.1 # Nonebot监听的IP如需外网访问改为0.0.0.0 <img src="https://cherishmoon.oss-cn-shenzhen.aliyuncs.com/LittlePaimon/readme/material.png" alt="material">
PORT=6789 # Nonebot监听的端口和go-cqhttp的端口一致 </details>
LOG_LEVEL=INFO # 日志等级
SUPERUSERS=["123456"] # 超级用户 <details>
NICKNAME=["派蒙", "bot"] # 机器人的昵称 <summary>抽卡记录</summary>
COMMAND_START=["", "/", "#"] # 命令前缀 <img src="https://cherishmoon.oss-cn-shenzhen.aliyuncs.com/LittlePaimon/readme/gachalog.jpg" alt="gachalog">
COMMAND_SEP=[""] # 命令分隔符 </details>
```
## 功能列表
### 3. 安装go-cqhttp
也不多说了看wiki的部署教程的go-cqhttp部分<br> 详见[功能列表](https://blog.cherishmoon.fun/bot/NoneBot2FuncList.html)
servers部分修改如下
``` ## 部署方法
servers: ### 我很熟悉NoneBot2
- ws-reverse:
universal: "ws://127.0.0.1:6789/onebot/v11/ws" + 部署NoneBot2和go-cqhttp
reconnect-interval: 3000
middlewares: + 克隆本项目
<<: *default - `git clone -b nonebot2 https://github.com/CMHopeSunshine/LittlePaimon `
access-token: ""
``` + 安装依赖
- ```shell
### 4. 安装插件 # 定时任务插件
``` nb plugin install nonebot-plugin-apscheduler
# 需要的依赖库
nb plugin install nonebot-plugin-apscheduler pip install aiohttp xlsxwriter sqlitedict matplotlib aiofiles
# 安装定时任务插件 ```
+ 启用插件
git clone -b nonebot2 https://github.com/CMHopeSunshine/LittlePaimon - ```python
# 克隆小派蒙nonebot2分支 # 编辑bot.py添加
``` nonebot.load_plugins("LittlePaimon")
编辑`bot.py` ```
```
nonebot.load_plugins("LittlePaimon") ### 我不熟悉NoneBot2
# 添加这句,加载插件 **详细部署教程:**
```
- [Linux](https://blog.cherishmoon.fun/bot/NoneBot2Deploy.html#linux)
### 5. 启动机器人 - [安卓系统](https://blog.cherishmoon.fun/bot/NoneBot2Deploy.html#%E5%9C%A8%E5%AE%89%E5%8D%93%E6%89%8B%E6%9C%BA%E4%B8%8A%E9%83%A8%E7%BD%B2)
`nb run` - [Windows](https://blog.cherishmoon.fun/bot/NoneBot2Deploy.html#windows)
### 添加公共cookie
部署完成后,你还需要至少添加一条**公共cookie**,小派蒙才能使用查询功能。
登录米游社网页版,在地址栏粘贴:
```
javascript:(function(){prompt(document.domain,document.cookie)})();
```
复制得到的cookie向小派蒙发送**`添加公共ck`**和粘贴的内容,即可开始使用
## 感谢
代码水平很烂站在巨人的肩膀上努力学习ing......
- [NoneBot2](https://github.com/nonebot/nonebot2) - 跨平台异步机器人框架
- [go-cqhttp](https://github.com/Mrs4s/go-cqhttp) - Onebot标准的框架实现
- 西北一枝花 - 部分图片的美工大大
- [egenshin](https://github.com/pcrbot/erinilis-modules/tree/master/egenshin) - 参考了它的抽卡代码和资源
- [西风驿站](https://bbs.mihoyo.com/ys/collection/307224) - 角色攻略一图流来源
- [bluemushoom](https://bbs.nga.cn/nuke.php?func=ucp&uid=62861898) - 全角色收益曲线和参考面板攻略图来源
- [genshin-gacha-export](https://github.com/sunfkny/genshin-gacha-export) - 抽卡记录导出参考
- [游创工坊](https://space.bilibili.com/176858937) - 深渊排行榜数据来源