From 80a482bc83ffa9e2e1f0d549e51db60260027cf5 Mon Sep 17 00:00:00 2001 From: Matthias Meusburger Date: Thu, 6 Sep 2012 17:47:48 +0200 Subject: [PATCH] Adds kickMode :) --- config.py | 4 ++++ plugin.py | 6 ++++++ 2 files changed, 10 insertions(+) diff --git a/config.py b/config.py index b28e7e7..66b052f 100644 --- a/config.py +++ b/config.py @@ -57,6 +57,10 @@ conf.registerChannelValue(DuckHunt, 'maxthrottle', registry.Integer(300, """ The maximum amount of time before a new duck may be launched (in seconds)""")) +conf.registerChannelValue(DuckHunt, 'kickMode', + registry.Boolean(True, """If someone shoots when there is no duck, should he be kicked from the channel?""")) + + # vim:set shiftwidth=4 softtabstop=4 expandtab textwidth=79: diff --git a/plugin.py b/plugin.py index 041eae1..9b0469c 100644 --- a/plugin.py +++ b/plugin.py @@ -39,6 +39,7 @@ import supybot.conf as conf import threading, random, pickle, os, time, datetime +# TODO: Average time class DuckHunt(callbacks.Plugin): """ @@ -668,6 +669,11 @@ class DuckHunt(callbacks.Plugin): irc.reply("There was no duck! %s: %i (%.2f seconds) " % (msg.nick, self.scores[currentChannel][msg.nick], bangdelay)) else: irc.reply("There was no duck! %s: %i" % (msg.nick, self.scores[currentChannel][msg.nick])) + + # If kickMode is enabled for this channel, and the bot have op capability, let's kick! + if self.registryValue('kickMode', currentChannel) and irc.nick in irc.state.channels[currentChannel].ops: + irc.queueMsg(ircmsgs.kick(currentChannel, msg.nick, 'There was no duck! You just shot yourself!')) + else: irc.reply("There is no hunt right now! You can start a hunt with the 'start' command") else: