@@ -49,7 +49,7 @@ def pre_chat(self, from_name, msg):
49
49
return True
50
50
51
51
# Process the message, and returns response
52
- def process_chat (self , from_name , msg ):
52
+ def process_chat (self , from_name , msg , login_wait = None ):
53
53
54
54
result = ''
55
55
skip_first = False
@@ -72,6 +72,9 @@ def process_chat(self, from_name, msg):
72
72
result_str = to_str (result )
73
73
self .logging .info ('Login Res: {0} Length: {1} for chatkey {2}' .format (result_str , str (len (result_str )), chat_key ))
74
74
75
+ if login_wait :
76
+ time .sleep (login_wait )
77
+
75
78
self .logging .debug ('User ask: {0} with chatkey' .format (msg .encode ('utf-8' ), chat_key ))
76
79
77
80
if skip_first and len (result ) != 0 :
@@ -95,13 +98,13 @@ def process_chat(self, from_name, msg):
95
98
96
99
return result
97
100
98
- def handle_chat (self , from_name , msg ):
101
+ def handle_chat (self , from_name , msg , login_wait = None ):
99
102
# Pre process and check if we really need to handle this message
100
103
if self .pre_chat (from_name , msg ):
101
104
# Process the message and give a response
102
- result = self .process_chat (from_name , msg )
105
+ result = self .process_chat (from_name , msg , login_wait = None )
103
106
104
- self .logging .debug ('Robot Response: {0}' .format (result ))
107
+ self .logging .debug ('Robot Response: {0} for chatkey {1} ' .format (result , from_name ))
105
108
106
109
if result and result != '' :
107
110
return result
0 commit comments