diff options
author | Richard Darst <rkd@zgib.net> | 2009-07-08 19:33:53 (GMT) |
---|---|---|
committer | Richard Darst <rkd@zgib.net> | 2009-07-08 19:33:53 (GMT) |
commit | 014d99acb4fa25f5c3d0f2a4bb814fab165a4210 (patch) | |
tree | ad26c2b4230f2ca38edb8c324d79ea9970913fa6 | |
parent | aded36e115745c500c23ae06cfd283298dbddf3a (diff) |
Add a `recent` supybot command to list recent meetings
- This is mainly to help audit use of the bot, see what channels and when
are using it. Right now limits to history of the last 10 meetings.
darcs-hash:20090708193353-82ea9-992a76035ab5237f89f686db12489587064166a3.gz
-rw-r--r-- | plugin.py | 19 |
1 files changed, 18 insertions, 1 deletions
@@ -49,7 +49,8 @@ try: meeting_cache except NameError: meeting_cache = {} - + recent_meetings = [ ] + class MeetBot(callbacks.Plugin): """Add the help for "@plugin help MeetBot" here @@ -102,6 +103,10 @@ class MeetBot(callbacks.Plugin): M._sendReply = _sendReply # callback to get supybot registry values. M._registryValue = self.registryValue + recent_meetings.append( + (channel, irc.msg.tags['receivedOn'], time.ctime())) + if len(recent_meetings) > 10: + del recent_meetings[0] # If there is no meeting going on, then we quit if M is None: return # Add line to our meeting buffer. @@ -163,6 +168,18 @@ class MeetBot(callbacks.Plugin): irc.reply("Deleted: meeting on (%s, %s)."%(channel, network)) deletemeeting = wrap(deletemeeting, ['admin', "channel", "something", optional("boolean", True)]) + def recent(self, irc, msg, args): + reply = [] + for channel, network, ctime in recent_meetings: + Mkey = (channel,network) + if Mkey in meeting_cache: state = ", running" + else: state = "" + reply.append("(%s, %s, %s%s)"%(channel, network, ctime, state)) + if reply: + irc.reply(" ".join(reply)) + else: + irc.reply("No recent meetings in internal state.") + recent = wrap(recent, ['admin']) def pingall(self, irc, msg, args, message): """<text> |