Skip to content

Commit

Permalink
fix a prompt bug of key_ans module
Browse files Browse the repository at this point in the history
  • Loading branch information
aicorein committed Dec 22, 2022
1 parent 9e373d0 commit 4a90b7b
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 21 deletions.
6 changes: 5 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,11 +1,15 @@
*.pyc
__pycache__
*/__pycache__
*.bak

logs
private
go-cqhttp

templates/py.py
templates/cpp.py
templates/weather.py
templates/translate.py
templates/translate.py
templates/summon.py
config/botConfig.toml
18 changes: 0 additions & 18 deletions corpus/key_ans.json
Original file line number Diff line number Diff line change
@@ -1,13 +1,4 @@
[
{
"keys": ["MeloTide", "MelodyTide", "律汐"],
"prob": 0.8,
"ans": [
{"sentence": "律汐最棒了~ awa"},
{"sentence": "嗯?是谁在叫我呀 owo(探头)"},
{"sentence": "(律汐探头)"}
]
},
{
"keys": ["好耶"],
"prob": 1,
Expand All @@ -28,14 +19,5 @@
"total-repeat": [0, 3]
}
]
},
{
"keys": ["律回", "MelodyEcho"],
"prob": 0.8,
"ans": [
{"sentence": "律回姐姐最棒!"},
{"sentence": "律回姐姐最好了 >w<!"},
{"sentence": "有人在讨论律回姐姐呢(偷听)"}
]
}
]
12 changes: 10 additions & 2 deletions utils/cmdInterface.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ async def after_cmd_func(event: dict, *args, **kwargs):
return
else:
# 只进行发送者权限的校验,更复杂的校验目标,应该由前端模块提前完成
if self.msg_checker.isMsgReport(event):

# 若在黑名单中,什么也不做
if self.msg_checker.get_event_lvl(event) == self.role.BLACK:
return None
elif self.msg_checker.isMsgReport(event):
if not self.msg_checker.check(userLevel, event):
return await self.sys_call('echo', event, \
f'需要 {self.msg_checker.auth_str_map[userLevel]} 权限,权限不够呢 qwq')
Expand Down Expand Up @@ -172,7 +176,11 @@ async def after_cmd_func(event: dict, *args, **kwargs):
return
else:
# 只进行发送者权限的校验,更复杂的校验目标,应该由前端模块提前完成
if self.msg_checker.isMsgReport(event):

# 若在黑名单中,什么也不做
if self.msg_checker.get_event_lvl(event) == self.role.BLACK:
return None
elif self.msg_checker.isMsgReport(event):
if not self.msg_checker.check(userLevel, event):
return await self.sys_call('echo', event, \
f'需要 {self.msg_checker.auth_str_map[userLevel]} 权限,权限不够呢 qwq')
Expand Down

0 comments on commit 4a90b7b

Please sign in to comment.