From 313da892425c720db34741a0e22b869045688700 Mon Sep 17 00:00:00 2001 From: Matthias Meusburger Date: Sun, 9 Sep 2012 17:08:05 +0200 Subject: [PATCH] Adds autoFriday channel value --- config.py | 2 ++ plugin.py | 9 ++++++++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/config.py b/config.py index 031b9c1..8b7bff8 100644 --- a/config.py +++ b/config.py @@ -60,6 +60,8 @@ conf.registerChannelValue(DuckHunt, conf.registerChannelValue(DuckHunt, 'kickMode', registry.Boolean(True, """If someone shoots when there is no duck, should he be kicked from the channel? (this requires the bot to be op on the channel)""")) +conf.registerChannelValue(DuckHunt, 'autoFriday', + registry.Boolean(True, """ Do we need to automatically launch more ducks on friday? """)) diff --git a/plugin.py b/plugin.py index fe3fe03..b8acc8d 100644 --- a/plugin.py +++ b/plugin.py @@ -179,6 +179,13 @@ class DuckHunt(callbacks.Plugin): if (not self.fridayMode.get(channel)): self.fridayMode[channel] = False + + + # autoFriday? + if self.registryValue('autoFriday', channel) and int(time.strftime("%w")) == 5 and int(time.strftime("%H")) > 8 and int(time.strftime("%H")) < 18: + self.fridayMode[channel] = True + + if self.fridayMode[channel] == False: # Init min throttle[currentChannel] and max throttle[currentChannel] if self.registryValue('minthrottle', channel): @@ -342,7 +349,7 @@ class DuckHunt(callbacks.Plugin): irc.error('You have to be on a channel') - fridaymode = wrap(fridaymode, ['channel']) + fridaymode = wrap(fridaymode, ['channel', 'admin']) def launched(self, irc, msg, args): """