X-Git-Url: http://git.kaliko.me/?a=blobdiff_plain;f=sid%2Fsid.py;h=53fd5696976f4a60d2d01ec7ec75dfaeb4066aaf;hb=e518fc7f4c42f6e911d85ce8f662b3d21b6da757;hp=7c3a5c7a6db9540b8fffb65dd3e4e240dbf759f1;hpb=e5063f532aeb1876b012586481413723605d1fc5;p=sid.git diff --git a/sid/sid.py b/sid/sid.py index 7c3a5c7..53fd569 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 = ''.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 < 20 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')