mirror of
https://github.com/Mikaela/Limnoria.git
synced 2025-01-11 04:32:36 +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
|
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
|
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
|
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
|
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:
|
it would be done without wrap:
|
||||||
|
|
||||||
def repeat(self, irc, msg, args):
|
def repeat(self, irc, msg, args):
|
||||||
"""<num> <text>
|
"""<num> <text>
|
||||||
|
|
||||||
Repeats <text> <num> times.
|
Repeats <text> <num> times.
|
||||||
"""
|
"""
|
||||||
@ -50,10 +50,9 @@ it would be done without wrap:
|
|||||||
num = int(num)
|
num = int(num)
|
||||||
except ValueError:
|
except ValueError:
|
||||||
raise callbacks.ArgumentError
|
raise callbacks.ArgumentError
|
||||||
return
|
|
||||||
irc.reply(num * text)
|
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
|
(and you should have seen it before we had privmsg.getArgs!). Now, here's what
|
||||||
our command will look like with wrap applied:
|
our command will look like with wrap applied:
|
||||||
|
|
||||||
@ -194,7 +193,7 @@ optional, the default value is shown.
|
|||||||
|
|
||||||
"now"
|
"now"
|
||||||
Simply returns the current timestamp as an arg, does not reference or
|
Simply returns the current timestamp as an arg, does not reference or
|
||||||
modify the argument list.
|
modify the argument list.
|
||||||
|
|
||||||
"url"
|
"url"
|
||||||
Checks for a valid URL.
|
Checks for a valid URL.
|
||||||
|
Loading…
Reference in New Issue
Block a user