From 3d81d6627bfddf6ad2c501a6e1b573457004cf30 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Thu, 30 Sep 2004 04:12:15 +0000 Subject: [PATCH] Updated to add the configurable single-letter commands. --- plugins/Words.py | 13 ++++++++++++- test/test_Words.py | 1 + 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/plugins/Words.py b/plugins/Words.py index b2bf28c90..5ecf1e9da 100644 --- a/plugins/Words.py +++ b/plugins/Words.py @@ -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) diff --git a/test/test_Words.py b/test/test_Words.py index dee2d0920..e281daa6e 100644 --- a/test/test_Words.py +++ b/test/test_Words.py @@ -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')