[irc] print traceback on exceptions

This commit is contained in:
HarHar 2013-01-24 21:24:24 -02:00
parent 76186bc17b
commit ac02d581b7

View File

@ -6,6 +6,7 @@ import socket
import threading import threading
from syncplay import utils from syncplay import utils
from time import sleep from time import sleep
import traceback
class Bot(object): class Bot(object):
def __init__(self, server='irc.rizon.net', serverPassword='', port=6667, nick='SyncBot', nickservPass='', channel='', channelPassword='', functions=[]): def __init__(self, server='irc.rizon.net', serverPassword='', port=6667, nick='SyncBot', nickservPass='', channel='', channelPassword='', functions=[]):
@ -172,6 +173,7 @@ def handlingThread(sock, bot):
while bot.active: while bot.active:
rcvd = sock.recv(4096).split('\n') rcvd = sock.recv(4096).split('\n')
for line in rcvd: for line in rcvd:
try:
line = line.replace('\r', '') line = line.replace('\r', '')
if line.split(' ')[0] == 'PING': if line.split(' ')[0] == 'PING':
@ -205,3 +207,5 @@ def handlingThread(sock, bot):
msg = msg[:-1].lstrip() msg = msg[:-1].lstrip()
# ---END WTF BLOCK- -- # ---END WTF BLOCK- --
bot.irc_onMsg(nfrom, addrnfrom, to, msg) bot.irc_onMsg(nfrom, addrnfrom, to, msg)
except:
print traceback.format_exc()