Download:
child 10:9fa8b4b32368
parent 8:8645840c53d1
9:88927ae72d71
Anton Shestakov <av6@dwimlabs.net>, Wed, 11 May 2016 14:43:23 +0800
rollbot: allow prefix in direct chat, don't strip tabs

1 файлов изменено, 7 вставок(+), 2 удалений(-) [+]
rollbot.py file | annotate | diff | comparison | revisions
--- a/rollbot.py Wed May 11 00:09:34 2016 +0800
+++ b/rollbot.py Wed May 11 14:43:23 2016 +0800
@@ -36,7 +36,12 @@
if msg['type'] not in ('chat', 'normal'):
return
- rbody = self.respond(msg['body'].strip())
+ mbody = msg['body'].lstrip()
+ if mbody.startswith(self.prefix):
+ mbody = mbody[len(self.prefix):]
+
+ mbody = mbody.lstrip(' ')
+ rbody = self.respond(mbody)
if rbody:
msg.reply(rbody)
msg.send()
@@ -53,7 +58,7 @@
else:
return
- mbody = mbody.lstrip(':, \t')
+ mbody = mbody.lstrip(':, ')
rbody = self.respond(mbody)
if rbody:
rbody = '%s: %s' % (msg['mucnick'], rbody)