diff --git a/bot.py b/bot.py index 0ba11d6..3564712 100755 --- a/bot.py +++ b/bot.py @@ -152,11 +152,12 @@ class Phenny(irc.Bot): self.bot = phenny def __getattr__(self, attr): + sender = origin.sender or text if attr == 'reply': return (lambda msg: - self.bot.msg(origin.sender, origin.nick + ': ' + msg)) + self.bot.msg(sender, origin.nick + ': ' + msg)) elif attr == 'say': - return lambda msg: self.bot.msg(origin.sender, msg) + return lambda msg: self.bot.msg(sender, msg) return getattr(self.bot, attr) return PhennyWrapper(self) diff --git a/modules/admin.py b/modules/admin.py index e1dd908..3c3356f 100755 --- a/modules/admin.py +++ b/modules/admin.py @@ -12,10 +12,13 @@ def join(phenny, input): # Can only be done in privmsg by an admin if input.sender.startswith('#'): return if input.admin: - phenny.write(['JOIN'], input.group(2)) -join.commands = ['join'] + channel, key = input.group(1), input.group(2) + if not key: + phenny.write(['JOIN'], channel) + else: phenny.write(['JOIN', channel, key]) +join.rule = r'\.join (#\S+)(?: *(\S+))?' join.priority = 'low' -join.example = '.join #example' +join.example = '.join #example or .join #example key' def part(phenny, input): """Part the specified channel. This is an admin-only command.""" diff --git a/modules/calc.py b/modules/calc.py index 9a3b174..e664cb2 100755 --- a/modules/calc.py +++ b/modules/calc.py @@ -61,7 +61,7 @@ def calc(phenny, input): elif ' in ' in q: result += ' ' + q.split(' in ', 1)[1] - phenny.say(q + ' = ' + result) + phenny.say(q + ' = ' + result[:350]) else: phenny.reply("Sorry, can't calculate that.") calc.commands = ['calc'] calc.example = '.calc 5 + 3' diff --git a/modules/translate.py b/modules/translate.py index 06efa62..baa430d 100755 --- a/modules/translate.py +++ b/modules/translate.py @@ -64,7 +64,7 @@ def tr(phenny, context): else: msg = 'The %s to %s translation failed, sorry!' % (input, output) phenny.reply(msg) - else: phenny.reply('Ehwhatnow?') + else: phenny.reply('Language guessing failed, so try suggesting one!') tr.rule = ('$nick', ur'(?:([a-z]{2}) +)?(?:([a-z]{2}) +)?["“](.+?)["”]\? *$') tr.example = '$nickname: "mon chien"? or $nickname: fr "mon chien"?' diff --git a/modules/wikipedia.py b/modules/wikipedia.py index 1af1c79..9827cc6 100755 --- a/modules/wikipedia.py +++ b/modules/wikipedia.py @@ -24,7 +24,7 @@ r_redirect = re.compile( abbrs = ['etc', 'ca', 'cf', 'Co', 'Ltd', 'Inc', 'Mt', 'Mr', 'Mrs', 'Dr', 'Ms', 'Rev', 'Fr', 'St', 'Sgt', 'pron', 'approx', 'lit', - 'syn'] \ + 'syn', 'transl'] \ + list('ABCDEFGHIJKLMNOPQRSTUVWXYZ') \ + list('abcdefghijklmnopqrstuvwxyz') t_sentence = r'^.{5,}?(?', '|')