mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-12-23 11:12:47 +01:00
Update USING_WRAP to match current practices.
This commit is contained in:
parent
0f41a92069
commit
f54c7b6149
@ -32,7 +32,7 @@ the following import line:
|
||||
|
||||
This will allow you to access the wrap command (and it allows you to do it
|
||||
without the commands prefix. Note that this line is added to the imports of
|
||||
plugin templates generated by the supybot-newplugin script.
|
||||
plugin templates generated by the supybot-plugin-create script.
|
||||
|
||||
Let's write a quickie command that uses wrap to get a feel for how it makes our
|
||||
lives better. Let's write a command that repeats a string of text a given
|
||||
@ -41,7 +41,7 @@ Not a very useful command, but it will serve our purpose just fine. Here's how
|
||||
it would be done without wrap:
|
||||
|
||||
def repeat(self, irc, msg, args):
|
||||
"""<num> <text>
|
||||
"""<num> <text>
|
||||
|
||||
Repeats <text> <num> times.
|
||||
"""
|
||||
@ -50,10 +50,9 @@ it would be done without wrap:
|
||||
num = int(num)
|
||||
except ValueError:
|
||||
raise callbacks.ArgumentError
|
||||
return
|
||||
irc.reply(num * text)
|
||||
|
||||
Note that all of the argument validation and parsing takes up 6 of the 7 lines
|
||||
Note that all of the argument validation and parsing takes up 5 of the 6 lines
|
||||
(and you should have seen it before we had privmsg.getArgs!). Now, here's what
|
||||
our command will look like with wrap applied:
|
||||
|
||||
@ -194,7 +193,7 @@ optional, the default value is shown.
|
||||
|
||||
"now"
|
||||
Simply returns the current timestamp as an arg, does not reference or
|
||||
modify the argument list.
|
||||
modify the argument list.
|
||||
|
||||
"url"
|
||||
Checks for a valid URL.
|
||||
|
Loading…
Reference in New Issue
Block a user