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
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):
"""
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')