From 45e106a7306ec7df2f4374ec3f9d9624223e1304 Mon Sep 17 00:00:00 2001 From: Richard Darst Date: Tue, 16 Jun 2009 02:17:16 +0000 Subject: Updates to some bot owner commands - Added commands: deletemeeting, addchair (existing commands: listmeetings savemeetings) - Change to anyone with the "admin" capability being able to run these. - These commands are designed so that the bot owner or admin can manage/ rescue/save meetings on other channels, even if the owner was not involved in starting the meeting. - These *are* regular supybot commands. They aren't designed for normal users. darcs-hash:20090616021716-82ea9-da24d54daac46c7929c0a577cb4c0fb29170ea4d.gz --- (limited to 'plugin.py') diff --git a/plugin.py b/plugin.py index 839278d..2a43dad 100644 --- a/plugin.py +++ b/plugin.py @@ -106,6 +106,8 @@ class MeetBot(callbacks.Plugin): #M.save() # now do_endmeeting in M calls the save functions del meeting_cache[Mkey] + # These are admin commands, for use by the bot owner when there + # are many channels which may need to be independently managed. def listmeetings(self, irc, msg, args): """List all currently-active meetings.""" reply = "" @@ -114,15 +116,45 @@ class MeetBot(callbacks.Plugin): irc.reply("No currently active meetings.") else: irc.reply(reply) - listmeetings = wrap(listmeetings, ['private', 'owner']) - + listmeetings = wrap(listmeetings, ['admin']) def savemeetings(self, irc, msg, args): """Save all currently active meetings.""" numSaved = 0 for M in meeting_cache: M.save() irc.reply("Saved %d meetings."%numSaved) - savemeetings = wrap(savemeetings, ['owner']) + savemeetings = wrap(savemeetings, ['admin']) + def addchair(self, irc, msg, args, channel, network, nick): + """ + + Add a nick as a chair to the meeting.""" + Mkey = (channel,network) + M = meeting_cache.get(Mkey, None) + if not M: + irc.reply("Meeting on channel %s, network %s not found"%( + channel, network)) + return + M.chairs.setdefault(nick, True) + irc.reply("Chair added: %s on (%s, %s)."%(nick, channel, network)) + addchair = wrap(addchair, ['admin', "channel", "something", "nick"]) + def deletemeeting(self, irc, msg, args, channel, network, save): + """ + + Delete a meeting from the cache. If save is given, save the + meeting first, defaults to saving.""" + Mkey = (channel,network) + if Mkey not in meeting_cache: + irc.reply("Meeting on channel %s, network %s not found"%( + channel, network)) + return + if save: + M = meeting_cache.get(Mkey, None) + import time + M.endtime = time.localtime() + M.save() + irc.reply("Deleted: meeting on (%s, %s)."%(channel, network)) + deletemeeting = wrap(deletemeeting, ['admin', "channel", "something", + optional("boolean", True)]) def pingall(self, irc, msg, args, message): """Send a broadcast ping to all users on the channel. -- cgit v0.9.1