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
1 changed files with 7 additions and 4 deletions

View File

@ -170,10 +170,13 @@ 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
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)
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
# Checks for messages.