Skip to content

Supybot Website

Sections
Personal tools
You are here: Home » Supybot Discussion Forums » User Forum » matcher -converter

 • matcher -converter

Document Actions
Replies: 2   Views: 1291
Up one level
You need to be a registered member to post to this forum. Register now.

 • matcher -converter

Posted by lassizci at 19:12 March 13, 2008
is it really working? I really really didn't get how. So here is what I tried with it: [code] def test(self, irc, msg, args, channel, match=None): irc.reply("%s" % match) test = wrap(test, [('matches', re.compile('a'), 'no match')]) [/code] Then I called the bot with '.test b' and it told "no match" as supposed. But then I tried with matching strings like "a" and "aaa" and the bot just returns "None". If I take 'match=None' away from function definition, the bot just raises error: [code]ERROR 2008-03-14T01:08:20 Spec: [, 'no match')>] ERROR 2008-03-14T01:08:20 Received args: [] ERROR 2008-03-14T01:08:20 Extra args: ['channel', 'match'] ERROR 2008-03-14T01:08:20 Uncaught exception in ['test']. Traceback (most recent call last): File "/home/lassizci/supybot/lib/python2.3/site-packages/supybot/callbacks.py", line 1170, in _callCommand self.callCommand(command, irc, msg, *args, **kwargs) File "/home/lassizci/supybot/lib/python2.3/site-packages/supybot/utils/python.py", line 62, in g f(self, *args, **kwargs) File "/home/lassizci/supybot/lib/python2.3/site-packages/supybot/callbacks.py", line 1156, in callCommand method(irc, msg, *args, **kwargs) File "/home/lassizci/supybot/lib/python2.3/site-packages/supybot/commands.py", line 906, in newf f(self, irc, msg, args, *state.args, **state.kwargs) TypeError: test() takes exactly 6 arguments (5 given) ERROR 2008-03-14T01:08:20 Exception id: 0xdcca6[/code]
Member
Posts: 3

 • Re: matcher -converter

Posted by lassizci at 19:15 March 13, 2008
I messed up with fromatting and can't edit :F

anyway, here is the test function code and here is the error message in more readable format.
Member
Posts: 3

 • Re: matcher -converter

Posted by lassizci at 07:19 March 15, 2008
ah, I was so blind. The problem was just the channel argument in function definition. Of course it's not given unless it's defined in wrap command. so 'channel' before mathes -tuple...

code:
def test(self, irc, msg, args, channel, match):
    irc.reply("%s" % match)
test = wrap(test,['channel', ('matches', re.compile('a'), 'no match')])


that works as supposed - returning <_sre.SRE_Match object at 0xb7932020>
Member
Posts: 3

 

Powered by Plone

This site conforms to the following standards: