diff options
author | Brian Sherson <caretaker82@euclid.shersonb.net> | 2013-08-27 20:25:22 -0700 |
---|---|---|
committer | Brian Sherson <caretaker82@euclid.shersonb.net> | 2013-08-27 20:25:22 -0700 |
commit | f1504f7162c8c43e3b06dd279370451e9b683e9c (patch) | |
tree | c0a6d06840cf42438041f5b6cc1c1fb82f7353a1 /cannon.py | |
parent | fc456d6660162f7ad3a278d00288865175b30281 (diff) |
Diffstat (limited to 'cannon.py')
l---------[-rw-r--r--] | cannon.py | 31 |
1 files changed, 1 insertions, 30 deletions
diff --git a/cannon.py b/cannon.py index 3af725e..1770271 100644..120000 --- a/cannon.py +++ b/cannon.py @@ -1,30 +1 @@ -#!/usr/bin/python - -import re, os - -class Cannon(object): - def __init__(self): - self.firecount={} - def onRecv(self, IRC, line, data): - if data==None: return - (origin, ident, host, cmd, target, params, extinfo)=data - if len(target) and target[0]=="#" and cmd=="PRIVMSG": - channel=IRC.channel(target) - matches=re.findall("^!fire\\s+(.*)$",extinfo) - if matches: - nickname=matches[0] - if any([nickname.lower()==user.nick.lower() for user in channel.users]): - user=IRC.user(nickname) - if user in self.firecount.keys(): - count=self.firecount[user]+1 - else: - count=1 - self.firecount[user]=count - if 10<=count%100<20: ordinal="th" - elif count%10==1: ordinal="st" - elif count%10==2: ordinal="nd" - elif count%10==3: ordinal="rd" - else: ordinal="th" - channel.me("fires %s out of a cannon for the %d%s time."%(user.nick, count, ordinal)) - else: - channel.msg("%s: I cannot fire %s out of a cannon, as he or she is not here."%(origin, nickname)) +../cannon.py
\ No newline at end of file |