Skip to content

Commit

Permalink
更新帮助
Browse files Browse the repository at this point in the history
  • Loading branch information
NekoRabi authored Mar 19, 2022
1 parent e7c6ce4 commit c006416
Show file tree
Hide file tree
Showing 5 changed files with 104 additions and 73 deletions.
86 changes: 56 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# 重构基本完成了
# 重构基本完成了,天凤功能安排中

# Majsoul-QQBot
一个基于YiriMirai的QQ机器人,有查询雀魂玩家信息、播报牌谱
Expand Down Expand Up @@ -59,49 +59,77 @@

风控相当于把这台设备禁言了,能够收到消息,后台显示发出消息了,但是并没发出去

如果是初次使用Mirai,风控几乎是必然的。机器人挂着放一两天就好了。
如果是初次使用,风控几乎是必然的。机器人挂着放一两天就好了。

# 配置文件

中文如果出现乱码,可以使用 VSCode “通过编码重新打开” ,选择编码为GBK。
### config.yml
``` 注意, '冒号' (:) 后必须有空格 ```
```
### 请注意 , 冒号(:)和横线(-) 后面必须要有用空格
adapter: # Mirai-Http-adapter参数
# Mirai
adapter:
host: localhost
port: 17280
verify_key: NekoRabi
admin: # 管理员QQ
# 以下都是管理员
admin:
- 0
alarmclockgroup: # 为群聊添加每天早安和准点报时
alarmclockgroup: # 设置闹钟群聊
- 0
blacklist: # 黑名单
- 0
botconfig:
botname: '' # 机器人的昵称,用于和机器人聊天交互
qq: 123456 # 请改成机器人的QQ号
commandpre: '' # 指令前缀
searchfrequency: 6 # 雀魂牌谱查询频率(单位: 分钟),不要太快,最好为60的因数
# 建议为 5 或 6 分钟
# 网络请求很耗时间,尤其是数据库用户很多的时候,在查询的过程中
# 机器人不会对外响应,所有操作将排队
mutegrouplist: # 屏蔽某群的消息(目前没做)
- 0
settings: # 各项开关设置
autogetpaipu: true # 自动抓取牌谱并广播,默认开启
autowelcome: true # 自动欢迎新人入群,默认开启
r18talk: true # 管理员应有独特对话的权力,对吧
setu: false # 开关色图功能
# 但是大概率会因为网络请求超时而发不出来
welcomeinfo:
# 欢迎消息,新人入群会从下面随机选择一条发送。
# %ps% 用于指代新入群的用户名字, %gn% 用于指代加入的群的群名字
- 欢迎 %ps% 加入群聊 %gn%
whitelist: # 白名单(功能暂无)
botconfig:
botname: '' # 机器人名字,若为空则没有机器人互动
qq: 123456 # 机器人QQ
commandpre: '' # 指令前缀
mutegrouplist:
- 0
searchfrequency: 6 # 查询频率,建议为 6
# 各项开关
settings:
autogetpaipu: true # 自动获取雀魂牌谱
autowelcome: true # 自动欢迎新人
r18talk: true # 开启管理员词库
setu: false # 色图
silence: false # 全局沉默
# 回复、打断相关,要求值从上到下排序为从大到小,否则不触发
# 数值为百分数,如 20 是 20% 或者 0.2 的概率
repeatconfig:
repeatQ: 20 # 复读问号 的概率
repeatmsg: 1 # 复读的概率
interruptQ: 0.5 # 用 ? 打断发言的概率
interruptQQ: 0.1 # 用 ¿ 或多个??打断发言的概率
# 设置单群沉默
silencegroup:
- 0
# 新人入群欢迎词,发送时 %ps% 会自动替换为新人名字, %gn% 会替换为群聊名字
welcomeinfo:
- 欢迎%ps%加入%gn%
# 白名单
whitelist:
- 0
```
## 回复文本相关
### 以 reply.json 为例
Expand Down Expand Up @@ -199,7 +227,7 @@ up: # up的物品池,如果十连参数为 限时,up列表的装扮和人物

[ ] 增加何切支持

[ ] 增加对天凤的支持
[?] 增加对天凤的支持

[ ] `要在自动查询牌谱时仍然能够对外相应`

Expand All @@ -226,8 +254,6 @@ QQ:1215791340 验证消息: 可爱的拉克丝

[YiriMirai](https://github.com/YiriMiraiProject/YiriMirai) : 提供SDK

[Yuzi_project](https://github.com/MEYUYU/yuzi-project) : 作者提供了大量帮助

[Saya_plugins_collection](https://github.com/SAGIRI-kawaii/saya_plugins_collection) : 移植功能

[AnimeThesaurus](https://github.com/Kyomotoi/AnimeThesaurus) : 回复语录提供
Expand Down
43 changes: 41 additions & 2 deletions command_help.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ ping
```
Hello World!

## 系统命令
```
addblacklist qq号
```
Expand All @@ -26,6 +27,15 @@ stext:: [群号] [文本]
向指定群发送文本


```
silence on/true
```
开启全局沉默模式,尽可能减少信息输出

其他参数时为关闭沉默模式



# 群聊命令

## 雀魂相关
Expand Down Expand Up @@ -73,16 +83,45 @@ qhdel / 雀魂删除关注 [玩家名]
查询一个玩家最近n场3/4人对局记录

```
qhinfo / 雀魂玩家详情 [玩家名] {3/4}
qhinfo / 雀魂玩家详情 [玩家名] {3/4} {'基本','立直','血统','更多','all'}
```

查询一个玩家的详细数据

```
qhyb / 雀魂月报 [玩家名] {3/4} [YYYY-m]
qhyb / 雀魂月报 [玩家名] {3/4} [YYYY-m]
```
获取一个玩家某月3/4麻月报,时间格式为 2022-3

## 天凤相关

```
thadd [玩家名]
```
添加一个玩家进入天凤对局查询队列,有新对局时会播报

```
thdel [玩家名]
```

将一个玩家从天凤对局查询队列中删除

```
thgetwatch
```
获取本群天凤关注


## 系统命令

```
silence on/true
```
开启该群的沉默模式,尽可能减少信息输出

其他参数时为关闭改群沉默模式



## 其他命令
```
Expand Down
38 changes: 2 additions & 36 deletions faq.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@


# yaml.scanner.ScannerError:
解决方法:yaml文件的格式不对,请检查 冒号 (:) 和 横线 (-) 后面是否有空格,并检查缩进

Expand Down Expand Up @@ -27,38 +25,6 @@ pip install uvicorn
pip install hypercorn
```
# 文件打开错误,尝试生成初始文件中...

# AttributeError: 'NoneType’object has no attribute 'call_soon_threadsafeTraceback (most recent call last) :
可能是由以下代码引起的,可以在 main.py 中将这段删掉

**大概率是由 _task.cancel() 引起的**
```
_task = None
@bot.on(Startup)
async def start_scheduler(_):
async def timer():
today_finished = False # 设置变量标识今天是会否完成任务,防止重复发送
while True:
await asyncio.sleep(1)
now = datetime.datetime.now()
if now.hour == 7 and now.minute == 30 and not today_finished: # 每天早上 7:30 发送早安
for group in alarmclockgroup:
await bot.send_group_message(group, "早上好")
today_finished = True
if now.hour == 7 and now.minute == 31:
today_finished = False # 早上 7:31,重置今天是否完成任务的标识
global _task
_task = asyncio.create_task(timer())
@bot.on(Shutdown)
async def stop_scheduler(_):
# 退出时停止定时任务
global _task
if _task:
_task.cancel()
```
请检查config.yml的数据是否齐全,格式是否正确 **(冒号和横线后面必须有空格)**
2 changes: 1 addition & 1 deletion main.py
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ async def getmajsoulhelp(event: MessageEvent):
" 举牌 [内容] :将内容写在举牌小人上发出来\n"
" 亲/亲亲 @用户 : 两人互亲\n"
" 摸/摸摸/摸头 @用户 : 摸某人头\n"
" 重开 / remake : 异世界转生"
" 重开 / remake : 异世界转生\n"
" 项目地址 : 获取项目链接")
]))

Expand Down
8 changes: 4 additions & 4 deletions plugin/preinit/load_application.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,12 @@ def load_config() -> dict:
except Exception as e:
print("文件打开错误,尝试生成初始文件中...")
with open(r'./config.yml', 'w') as f:
yaml.dump(dict(admin=[1215791340], whitelist=[1215791340], blacklist=[0], mutegrouplist=[0],
welcomeinfo=["欢迎%ps%加入%gn%"], alarmclockgroup=[566415871],
yaml.dump(dict(admin=[0], whitelist=[0], blacklist=[0], mutegrouplist=[0],
welcomeinfo=["欢迎%ps%加入%gn%"], alarmclockgroup=[0],
silencegroup=[0], commandpre="", searchfrequency=6,
botconfig=dict(qq=3384437741, botname="拉克丝", ),
botconfig=dict(qq=123456, botname="", ),
repeatconfig=dict(repeatQ=20, repeatmsg=1, interruptQ=0.5, interruptQQ=0.1),
adapter=dict(verify_key='xyshu123', host='localhost',
adapter=dict(verify_key='NekoRabi', host='localhost',
port=17280),
settings=dict(autogetpaipu=True, autowelcome=True, r18talk=True, setu=False, silence=False)),
f, allow_unicode=True)
Expand Down

0 comments on commit c006416

Please sign in to comment.