Updated to add the configurable single-letter commands.

This commit is contained in:
Jeremy Fincher 2004-09-30 04:12:15 +00:00
parent b3631cb22e
commit 3d81d6627b
2 changed files with 13 additions and 1 deletions

View File

@ -65,7 +65,9 @@ conf.registerChannelValue(conf.supybot.plugins.Words.hangman, 'prefix',
conf.registerChannelValue(conf.supybot.plugins.Words.hangman, 'timeout',
registry.Integer(300, """Determines how long a game must be idle before it
will be replaced with a new game."""))
conf.registerChannelValue(conf.supybot.plugins.Words.hangman, 'letterCommands',
registry.Boolean(True, """Determines whether the bot will provide a command
for each letter while a game is in progress in a channel."""))
def wordsFile():
return file(conf.supybot.plugins.Words.file())
@ -180,6 +182,15 @@ class Words(callbacks.Privmsg):
###
# HANGMAN
###
def tokenizedCommand(self, irc, msg, tokens):
channel = msg.args[0]
if ircutils.isChannel(channel):
if channel in self.games:
if len(tokens) == 1:
c = tokens[0]
if c.isalpha():
self.guess(irc, msg, [c])
games = ircutils.IrcDict()
validLetters = list(string.ascii_lowercase)

View File

@ -54,6 +54,7 @@ class WordsTestCase(ChannelPluginTestCase, PluginDocumentation):
self.assertNotError('guess hello')
self.assertNotError('hangman')
self.assertNotError('guess j')
self.assertNotError('g')
self.assertNotError('letters')