summaryrefslogtreecommitdiff
path: root/AyaBot/plugins
diff options
context:
space:
mode:
authorKyomotoi <[email protected]>2020-07-13 13:21:14 +0800
committerGitHub <[email protected]>2020-07-13 13:21:14 +0800
commitfbbba78e84dc17fe91a14e83129756bad9f8e2aa (patch)
tree0f4987904945063489a36955510badd004f0ef67 /AyaBot/plugins
parent4e54e1c3b0bc9c6fa03ce5db4b23e132c47605a4 (diff)
downloadATRI-fbbba78e84dc17fe91a14e83129756bad9f8e2aa.tar.gz
ATRI-fbbba78e84dc17fe91a14e83129756bad9f8e2aa.tar.bz2
ATRI-fbbba78e84dc17fe91a14e83129756bad9f8e2aa.zip
Update chat.py
Diffstat (limited to 'AyaBot/plugins')
-rw-r--r--AyaBot/plugins/chat.py38
1 files changed, 33 insertions, 5 deletions
diff --git a/AyaBot/plugins/chat.py b/AyaBot/plugins/chat.py
index 33d4291..8227052 100644
--- a/AyaBot/plugins/chat.py
+++ b/AyaBot/plugins/chat.py
@@ -70,11 +70,39 @@ class Chat(object):
@on_command('chat')
async def chat(session: CommandSession):
- msg = session.state.get('msg')
- reply = await Chat.request(msg)
- await session.finish(reply)
- return
+ if chat_switch:
+ msg = session.state.get('msg')
+ reply = await Chat.request(msg)
+ await session.finish(reply)
+ return
+ else:
+ await session.send('えつ,アトリ被主人告知不能与陌生人说话')
@on_natural_language
async def _(session: NLPSession):
- return IntentCommand(60.0, ('chat'), {'msg': session.msg_text}) \ No newline at end of file
+ return IntentCommand(60.0, ('chat'), {'msg': session.msg_text})
+
+chat_switch = True
+@on_command('chat_switch', aliases=['开启', '关闭'], only_to_me=False)
+async def _(session: CommandSession):
+ if session.event.user_id in master:
+ command = session.event.raw_message.split(' ', 1)
+ switch = command[0]
+ com = command[1]
+ global chat_switch
+ if switch == '开启':
+ if com == '闲聊':
+ chat_switch = True
+ else:
+ pass
+
+ elif switch == '关闭':
+ if com == '闲聊':
+ chat_switch = False
+ else:
+ pass
+
+ await session.send('完成')
+
+ else:
+ await session.send('恁哪位?')