Tried to add bug detection.

This commit is contained in:
Christian P. MOMON 2020-07-04 18:24:58 +02:00 committed by root
parent 2de7d495d3
commit 2d11e3ad35

View File

@ -170,8 +170,11 @@ class Bot(object):
# them to the console. This function will be run in a thread, see below.
def msg_handler(self): # pragma: no cover (this excludes this function from testing)
new_msg = self.ircsock.recv(2048) # receive data from the server
if not new_msg:
print "Empty recv."
new_msg=''
else:
new_msg = new_msg.strip('\n\r') # removing any unnecessary linebreaks
if new_msg != '' and new_msg.find("PING :") == -1:
print(datetime.datetime.now().isoformat() + " " + new_msg)
return new_msg