diff --git a/docs/DocBook/example.sgml b/docs/DocBook/example.sgml
index bfee0ca8f..95789a757 100644
--- a/docs/DocBook/example.sgml
+++ b/docs/DocBook/example.sgml
@@ -25,6 +25,13 @@
14 Sep 2003
Converted to DocBook
+
+ 0.3
+ 24 Nov 2003
+
+ Updated to match EXAMPLE included with 0.75.0
+
+
@@ -141,10 +148,6 @@ def configure(onStart, afterConnect, advanced):
from questions import expect, anything, something, yn
onStart.append('load Random')
-example = utils.wrapLines("""
-Add an example IRC session using this module here.
-""")
-
class Random(callbacks.Privmsg):
pass
@@ -153,6 +156,7 @@ Class = Random
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
+
Customizing the boilerplate code
@@ -173,10 +177,9 @@ Class = Random
numbers."
- Then there are the imports. The utils
- module is used (in example, which we'll see later). The
- callbacks module is used (the class you're
- given subclasses callbacks.Privmsg) but the
+ Then there are the imports. The callbacks
+ module is used (the class you're given subclasses
+ callbacks.Privmsg) but the
privmsgs module isn't used. That's
alright; we can almost guarantee you'll use it, so we go ahead
and add the import to the template.
@@ -193,16 +196,7 @@ Class = Random
might need to ask questions and add commands based on the
answers.
-
- Then there's an example string. It's simply an example of
- usage of the plugin in practice.
- scripts/setup.py offers to show the
- user an example of the module usage; this is what it shows
- them. You'll note that it's wrapped for you in
- utils.wrapLines so you don't have to bother
- with it; just paste a session directly out of your IRC client
- and you'll be set.
-
+
Digging in: customizing the plugin class
@@ -379,7 +373,7 @@ def __init__(self):
framework handles that entirely transparently to you. Do make
sure, however, that you give irc.reply a
string. It doesn't take anything else (sometimes even unicode
- fails!). That's why we have "str(self.rnd.random())" instead
+ fails!). That's why we have "str(self.rng.random())" instead
of simply "self.rng.random()" -- we had to give
irc.reply a string.
@@ -485,7 +479,7 @@ def __init__(self):
Returns a number between <start> and <end>, inclusive (i.e., the number
can be either of the endpoints.
"""
- (start, end) = privmsgs.getArgs(args, needed=2)
+ (start, end) = privmsgs.getArgs(args, required=2)
try:
end = int(end)
start = int(start)
@@ -499,10 +493,11 @@ def __init__(self):
Pretty simple. This is becoming old hat by now. The only new
thing here is the call to
privmsgs.getArgs. We have to make sure,
- since we want two values, to pass a keyword parameter "needed"
- into privmsgs.getArgs. Of course,
- privmsgs.getArgs handles all the checking
- for missing arguments and whatnot so we don't have to.
+ since we want two values, to pass a keyword parameter
+ "required" into privmsgs.getArgs. Of
+ course, privmsgs.getArgs handles all the
+ checking for missing arguments and whatnot so we don't have
+ to.
The Random object we're using offers us a
@@ -583,7 +578,7 @@ def __init__(self):
of sides is 6.
"""
try:
- n = privmsgs.getArgs(args, needed=0, optional=1)
+ n = privmsgs.getArgs(args, required=0, optional=1)
if not n:
n = 6
n = int(n)
@@ -603,7 +598,7 @@ def __init__(self):
six-sided die :)) privmsgs.getArgs
supports that; we'll just tell it that we don't
need any arguments (via
- needed=0) and that we might
+ required=0) and that we might
like one argument (optional=1).
If the user provides an argument, we'll get it -- if they
don't, we'll just get an empty string. Hence the "if not n: n
@@ -702,42 +697,11 @@ def configure(onStart, afterConnect, advanced):
scripts/setup.py creates for the bot.
- Now the only thing missing from our plugin is an example.
- Here, I'll make one really quickly:
-
-
- <jemfinch> $list Random
- <angryman> diceroll, random, range, sample, seed
- <jemfinch> $random
- <angryman> 0.478084042957
- <jemfinch> $random
- <angryman> 0.960634332773
- <jemfinch> $seed 50
- <angryman> The operation succeeded.
- <jemfinch> $random
- <angryman> 0.497536568759
- <jemfinch> $seed 50
- <angryman> The operation succeeded.
- <jemfinch> $random
- <angryman> 0.497536568759
- <jemfinch> $range 1 10
- <angryman> 3
- <jemfinch> $range 1 10000000000000
- <angryman> 6374111614437
- <jemfinch> $diceroll
- * angryman rolls a 2
- <jemfinch> $diceroll
- * angryman rolls a 3
- <jemfinch> $diceroll 100
- * angryman rolls a 97
-
-
- So we'll throw this into our example string (where the
- template says to put it) and then we're done! We've written
- our own plugin from scratch (well, from the boilerplate that
- we got from scripts/newplugin.py
- :)) and survived! Now go write more plugins for supybot, and
- send them to me so I can use them too :)
+ We've written our own plugin from scratch (well, from the
+ boilerplate that we got from
+ scripts/newplugin.py :)) and
+ survived! Now go write more plugins for supybot, and send
+ them to me so I can use them too :)
diff --git a/docs/EXAMPLE b/docs/EXAMPLE
index b5733ce38..f5f74f3a8 100644
--- a/docs/EXAMPLE
+++ b/docs/EXAMPLE
@@ -342,7 +342,7 @@ function:
Pretty simple. This is becoming old hat by now. The only new thing
here is the call to privmsgs.getArgs. We have to make sure, since we
-want two values, to pass a keyword parameter "needed" into
+want two values, to pass a keyword parameter "required" into
privmsgs.getArgs. Of course, privmsgs.getArgs handles all the
checking for missing arguments and whatnot so we don't have to.