diff options
author | Brian Sherson <caretaker82@euclid.shersonb.net> | 2014-03-11 18:48:59 -0700 |
---|---|---|
committer | Brian Sherson <caretaker82@euclid.shersonb.net> | 2014-03-11 18:48:59 -0700 |
commit | 0b695d73168af6a8444e1c0a0f4e6b0f85506fc4 (patch) | |
tree | 8d225ac56cfb345b81e70e7f4c27df43d1ac4658 /cannon.py | |
parent | 0ec6553cffaa4bf115efddf815caa7cea56527d7 (diff) |
Major changes
Diffstat (limited to 'cannon.py')
-rw-r--r-- | cannon.py | 15 |
1 files changed, 9 insertions, 6 deletions
@@ -5,6 +5,7 @@ import os class Cannon(object): + def __init__(self): self.firecount = {} @@ -15,24 +16,26 @@ class Cannon(object): if any([nickname.lower() == usr.nick.lower() for usr in channel.users]): vic = IRC.user(nickname) if vic in self.firecount.keys(): - count = self.firecount[vic]+1 + count = self.firecount[vic] + 1 else: count = 1 self.firecount[vic] = count - if 10 <= count%100 < 20: + if 10 <= count % 100 < 20: ordinal = "th" - elif count%10 == 1: + elif count % 10 == 1: ordinal = "st" - elif count%10 == 2: + elif count % 10 == 2: ordinal = "nd" - elif count%10 == 3: + elif count % 10 == 3: ordinal = "rd" else: ordinal = "th" channel.me("fires %s out of a cannon for the %d%s time." % (vic.nick, count, ordinal)) else: - channel.msg("%s: I cannot fire %s out of a cannon, as he or she is not here."%(user.nick, nickname)) + channel.msg( + "%s: I cannot fire %s out of a cannon, as he or she is not here." % + (user.nick, nickname)) def onSendChanMsg(self, IRC, origin, channel, targetprefix, msg): self.onChanMsg(IRC, IRC.identity, channel, targetprefix, msg) |