X-Git-Url: https://git.kaliko.me/?a=blobdiff_plain;f=sid%2Fsid.py;h=1d3383c9b3c7f87d131f0939bf37ed44f1655b2d;hb=6111ca5fcf8cb38596130688f7883f3e87f4c362;hp=dd768c17c1f929664020c19564d1347b124f0c06;hpb=1d5d7c371bdecaf42cd6785f8c8ab152f0eaec48;p=sid.git diff --git a/sid/sid.py b/sid/sid.py index dd768c1..1d3383c 100644 --- a/sid/sid.py +++ b/sid/sid.py @@ -89,7 +89,7 @@ class MUCBot(sleekxmpp.ClientXMPP): def muc_message(self, msg): # ignore message from self - body = msg['body'] + body = msg['body'].strip() mucfrom = msg['mucnic'] if msg['mucnick'] == self.nick: return @@ -103,11 +103,12 @@ class MUCBot(sleekxmpp.ClientXMPP): if args: self.log.debug('arg: {0}'.format(args)) try: - reply = self.commands[cmd](msg, args) + self.commands[cmd](msg, args) except Exception as err: - reply = traceback.format_exc(err) + reply = ''.join(traceback.format_exc()) self.log.exception('An error occurred processing: {0}: {1}'.format(body, reply)) - self.send_message(mto=msg['from'].bare, mbody=reply, mtype='groupchat') + if self.log.level < 10 and reply: + self.send_message(mto=msg['from'].bare, mbody=reply, mtype='groupchat') def start(self, event): """ @@ -179,4 +180,4 @@ class MUCBot(sleekxmpp.ClientXMPP): text = self.commands[args[0]].__doc__.strip() or 'undocumented' else: text = 'That command is not defined.' - return text + self.send_message(mto=message['from'].bare, mbody=text, mtype='groupchat')