mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-19 08:59:27 +01:00
commands.wrap update
This commit is contained in:
parent
242ecb4f8f
commit
c6afe40abc
@ -47,7 +47,7 @@ from itertools import imap
|
|||||||
|
|
||||||
import supybot.conf as conf
|
import supybot.conf as conf
|
||||||
import supybot.utils as utils
|
import supybot.utils as utils
|
||||||
from supybot.commands import wrap
|
from supybot.commands import *
|
||||||
import supybot.ircmsgs as ircmsgs
|
import supybot.ircmsgs as ircmsgs
|
||||||
import supybot.ircutils as ircutils
|
import supybot.ircutils as ircutils
|
||||||
import supybot.registry as registry
|
import supybot.registry as registry
|
||||||
@ -300,7 +300,7 @@ class Fun(callbacks.Privmsg):
|
|||||||
length, use 0.
|
length, use 0.
|
||||||
"""
|
"""
|
||||||
irc.reply(utils.soundex(text, length))
|
irc.reply(utils.soundex(text, length))
|
||||||
soundex = wrap(soundex, ['text', ('?int', 4)])
|
soundex = wrap(soundex, ['text', optional('int', 4)])
|
||||||
|
|
||||||
# The list of words and algorithm are pulled straight the mozbot
|
# The list of words and algorithm are pulled straight the mozbot
|
||||||
# MagicEightBall.bm module: http://tinyurl.com/7ytg7
|
# MagicEightBall.bm module: http://tinyurl.com/7ytg7
|
||||||
@ -339,7 +339,7 @@ class Fun(callbacks.Privmsg):
|
|||||||
irc.reply(self._checkTheBall(len(text)))
|
irc.reply(self._checkTheBall(len(text)))
|
||||||
else:
|
else:
|
||||||
irc.reply(self._checkTheBall(random.randint(0, 2)))
|
irc.reply(self._checkTheBall(random.randint(0, 2)))
|
||||||
eightball = wrap(eightball, ['?text'])
|
eightball = wrap(eightball, [optional('text')])
|
||||||
|
|
||||||
_rouletteChamber = random.randrange(0, 6)
|
_rouletteChamber = random.randrange(0, 6)
|
||||||
_rouletteBullet = random.randrange(0, 6)
|
_rouletteBullet = random.randrange(0, 6)
|
||||||
@ -367,7 +367,7 @@ class Fun(callbacks.Privmsg):
|
|||||||
irc.reply('*click*')
|
irc.reply('*click*')
|
||||||
self._rouletteChamber += 1
|
self._rouletteChamber += 1
|
||||||
self._rouletteChamber %= 6
|
self._rouletteChamber %= 6
|
||||||
roulette = wrap(roulette, ['public', ('?literal', False, 'spin')])
|
roulette = wrap(roulette, ['public', optional(('literal', 'spin'))])
|
||||||
|
|
||||||
def monologue(self, irc, msg, args, channel):
|
def monologue(self, irc, msg, args, channel):
|
||||||
"""[<channel>]
|
"""[<channel>]
|
||||||
|
@ -42,7 +42,7 @@ import supybot.registry as registry
|
|||||||
|
|
||||||
import supybot.conf as conf
|
import supybot.conf as conf
|
||||||
import supybot.utils as utils
|
import supybot.utils as utils
|
||||||
from supybot.commands import wrap
|
from supybot.commands import *
|
||||||
import supybot.plugins as plugins
|
import supybot.plugins as plugins
|
||||||
import supybot.ircutils as ircutils
|
import supybot.ircutils as ircutils
|
||||||
import supybot.webutils as webutils
|
import supybot.webutils as webutils
|
||||||
@ -149,15 +149,15 @@ class Gameknot(callbacks.PrivmsgCommandAndRegexp):
|
|||||||
raise callbacks.Error, webutils.strError(e)
|
raise callbacks.Error, webutils.strError(e)
|
||||||
|
|
||||||
|
|
||||||
def gkstats(self, irc, msg, args):
|
def gkstats(self, irc, msg, args, name):
|
||||||
"""<name>
|
"""<name>
|
||||||
|
|
||||||
Returns the stats Gameknot keeps on <name>. Gameknot is an online
|
Returns the stats Gameknot keeps on <name>. Gameknot is an online
|
||||||
website for playing chess (rather similar to correspondence chess, just
|
website for playing chess (rather similar to correspondence chess, just
|
||||||
somewhat faster) against players from all over the world.
|
somewhat faster) against players from all over the world.
|
||||||
"""
|
"""
|
||||||
name = privmsgs.getArgs(args)
|
|
||||||
irc.reply(self.getStats(name))
|
irc.reply(self.getStats(name))
|
||||||
|
gkstats = wrap(gkstats, ['text'])
|
||||||
|
|
||||||
_gkPlayer = re.compile(r"popd\('(Rating[^']+)'\).*?>([^<]+)<")
|
_gkPlayer = re.compile(r"popd\('(Rating[^']+)'\).*?>([^<]+)<")
|
||||||
_gkRating = re.compile(r": (\d+)[^:]+:<br>(\d+)[^,]+, (\d+)[^,]+, (\d+)")
|
_gkRating = re.compile(r": (\d+)[^:]+:<br>(\d+)[^,]+, (\d+)[^,]+, (\d+)")
|
||||||
|
@ -77,6 +77,8 @@ class FunTest(ChannelPluginTestCase, PluginDocumentation):
|
|||||||
self.assertRegexp('chr %s' % i, regexp)
|
self.assertRegexp('chr %s' % i, regexp)
|
||||||
|
|
||||||
def testXor(self):
|
def testXor(self):
|
||||||
|
# This no longer works correctly. It almost seems like were throwing
|
||||||
|
# in a repr() somewhere.
|
||||||
L = [nick for nick in nicks if '|' not in nick and
|
L = [nick for nick in nicks if '|' not in nick and
|
||||||
'[' not in nick and
|
'[' not in nick and
|
||||||
']' not in nick]
|
']' not in nick]
|
||||||
@ -93,6 +95,8 @@ class FunTest(ChannelPluginTestCase, PluginDocumentation):
|
|||||||
self.assertResponse('ord %s' % utils.dqrepr(c), str(i))
|
self.assertResponse('ord %s' % utils.dqrepr(c), str(i))
|
||||||
|
|
||||||
def testEncodeDecode(self):
|
def testEncodeDecode(self):
|
||||||
|
# This no longer works correctly. It almost seems like were throwing
|
||||||
|
# in a repr() somewhere.
|
||||||
s = 'the recalcitrant jamessan tests his scramble function'
|
s = 'the recalcitrant jamessan tests his scramble function'
|
||||||
self.assertNotRegexp('encode aldkfja foobar', 'LookupError')
|
self.assertNotRegexp('encode aldkfja foobar', 'LookupError')
|
||||||
self.assertNotRegexp('decode asdflkj foobar', 'LookupError')
|
self.assertNotRegexp('decode asdflkj foobar', 'LookupError')
|
||||||
|
Loading…
Reference in New Issue
Block a user