Skip to content

Commit acf5dd9

Browse files
committed
Fix open/close logic.
1 parent 6f889b0 commit acf5dd9

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

bot.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,16 +47,17 @@ def auto_switch(self, msg):
4747
START = [u'出来', u'启动', u'工作']
4848
if self.robot_switch:
4949
for i in STOP:
50-
if i in msg_data :
50+
if i == msg_data:
5151
self.robot_switch = False
5252
self.send_msg_by_uid(u'[Robot]' + u'机器人已关闭!', msg['to_user_id'])
5353
else:
5454
for i in START:
55-
if i in msg_data:
55+
if i == msg_data:
5656
self.robot_switch = True
57+
self.send_msg_by_uid(u'[Robot]' + u'机器人已开启!', msg['to_user_id'])
5758

5859
def handle_msg_all(self, msg):
59-
if not self.robot_switch:
60+
if not self.robot_switch and msg['msg_type_id'] != 1:
6061
return
6162
if msg['msg_type_id'] == 1 and msg['content']['type'] == 0: # reply to self
6263
self.auto_switch(msg)

0 commit comments

Comments
 (0)