Adds kickMode :)

This commit is contained in:
Matthias Meusburger 2012-09-06 17:47:48 +02:00
parent 5830c4007e
commit 80a482bc83
2 changed files with 10 additions and 0 deletions

View File

@ -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:

View File

@ -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: