Output exception warnings to stderr
This commit is contained in:
parent
9e5356590e
commit
39da2633f5
10
hybridbot.py
10
hybridbot.py
@ -58,7 +58,7 @@ class IRCBot:
|
|||||||
if nick not in self.inter.get_irc_users():
|
if nick not in self.inter.get_irc_users():
|
||||||
self.inter.append_irc_user(nick)
|
self.inter.append_irc_user(nick)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
sys.stderr.write(str(e) + '\n')
|
||||||
|
|
||||||
def on_namreply(self, conn, event):
|
def on_namreply(self, conn, event):
|
||||||
for nick in event.arguments[2].split():
|
for nick in event.arguments[2].split():
|
||||||
@ -75,7 +75,7 @@ class IRCBot:
|
|||||||
for i in range(0, len(msg), buffer):
|
for i in range(0, len(msg), buffer):
|
||||||
self.conn.privmsg(self.opts['chan'], msg[i:i + buffer])
|
self.conn.privmsg(self.opts['chan'], msg[i:i + buffer])
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
sys.stderr.write(str(e) + '\n')
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
self.register_handlers()
|
self.register_handlers()
|
||||||
@ -125,14 +125,14 @@ class XMPPBot:
|
|||||||
if nick not in self.inter.get_xmpp_users():
|
if nick not in self.inter.get_xmpp_users():
|
||||||
self.inter.append_xmpp_user(nick)
|
self.inter.append_xmpp_user(nick)
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
sys.stderr.write(str(e) + '\n')
|
||||||
|
|
||||||
def send_message(self, msg):
|
def send_message(self, msg):
|
||||||
try:
|
try:
|
||||||
self.client.send_message(mto=self.opts['muc'], mbody=msg,
|
self.client.send_message(mto=self.opts['muc'], mbody=msg,
|
||||||
mtype='groupchat')
|
mtype='groupchat')
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
sys.stderr.write(str(e) + '\n')
|
||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
self.client.register_plugin('xep_0045') # XMPP MUC.
|
self.client.register_plugin('xep_0045') # XMPP MUC.
|
||||||
@ -235,7 +235,7 @@ class Intermedia:
|
|||||||
self.to_irc(nick_prefix + m)
|
self.to_irc(nick_prefix + m)
|
||||||
|
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
print(e)
|
sys.stderr.write(str(e) + '\n')
|
||||||
|
|
||||||
def get_irc_users(self):
|
def get_irc_users(self):
|
||||||
return self.irc_users
|
return self.irc_users
|
||||||
|
Loading…
Reference in New Issue
Block a user