From 9d51e998b545bb1e387f3cf59197e16585dc2325 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Wed, 27 Aug 2003 18:06:26 +0000 Subject: [PATCH] Added example strings. --- plugins/Amazon.py | 10 +++++++ plugins/BadWords.py | 30 +++++++++++++++---- plugins/ChannelDB.py | 16 +++++++++++ plugins/Debian.py | 11 ++++++- plugins/Gameknot.py | 18 ++++++++++-- plugins/Google.py | 18 ++++++++++++ plugins/IMDB.py | 11 +++++++ plugins/Moobot.py | 59 +++++++++++++++++++++++++++++++++++--- plugins/OSU.py | 12 ++++++++ plugins/Topic.py | 24 ++++++++++++---- plugins/TwistedCommands.py | 20 ++++++++++++- plugins/Unix.py | 21 ++++++++++++++ plugins/Utilities.py | 27 +++++++++++++++++ 13 files changed, 257 insertions(+), 20 deletions(-) diff --git a/plugins/Amazon.py b/plugins/Amazon.py index 32d1ee5f1..cd89df1e1 100644 --- a/plugins/Amazon.py +++ b/plugins/Amazon.py @@ -60,6 +60,16 @@ def configure(onStart, afterConnect, advanced): print 'You can apply for a key at http://www.amazon.com/webservices' +example = utils.wrapLines(""" + @list Amazon + amazonlicensekey, isbn + (amazonlicense key is used to set the license key to access Amazon's web services. We won't show that here, for obvious reasons.) + @isbn 0-8050-3906-6 + "Winning With the French (Openings)", written by Wolfgang Uhlmann; published by Henry Holt & Company, Inc.. + @isbn 0805039066 + "Winning With the French (Openings)", written by Wolfgang Uhlmann; published by Henry Holt & Company, Inc.. +""") + class Amazon(callbacks.Privmsg): threaded = True def amazonlicensekey(self, irc, msg, args): diff --git a/plugins/BadWords.py b/plugins/BadWords.py index 59ac326f5..4be6ce6b6 100644 --- a/plugins/BadWords.py +++ b/plugins/BadWords.py @@ -32,12 +32,6 @@ """ Filters bad words on outgoing messages from the bot, so the bot can't be made to say bad words. - -Commands include: - addbadword - removebadword - addbadwords - removebadwords """ from baseplugin import * @@ -45,6 +39,7 @@ from baseplugin import * import re import sets +import utils import ircdb import ircmsgs import privmsgs @@ -57,6 +52,29 @@ def configure(onStart, afterConnect, advanced): words = anything('What words? (separate individual words by spaces)') onStart.append('addbadwords %s' % words) +example = utils.wrapLines(""" + @load BadWords + The operation succeeded. + @list BadWords + addbadword, addbadwords, removebadword, removebadwords + @addbadword darn + The operation succeeded. + @rot13 qnea + !@#$ + @removebadword darn + The operation succeeded. + @rot13 qnea + darn + @addbadwords darn dang shoot + The operation succeeded. + @rot13 qnea qnat fubbg + !@#$ !@#$ !@#$! + @removebadwords darn dang shoot + The operation succeeded. + @rot13 qnea qnat fubbg + darn dang shoot +""") + nastyChars = '!@#$' * 256 def subber(m): return nastyChars[:len(m.group(1))] diff --git a/plugins/ChannelDB.py b/plugins/ChannelDB.py index f9225555e..39956573e 100644 --- a/plugins/ChannelDB.py +++ b/plugins/ChannelDB.py @@ -51,6 +51,22 @@ import privmsgs import ircutils import callbacks +example = utils.wrapLines(""" + @list ChannelDB + channelstats, karma, seen, stats + @channelstats + Error: Command must be sent in a channel or include a channel in its arguments. + (Obviously, you gotta give it a channel :)) + @channelstats #sourcereview + On #sourcereview there have been 46965 messages, containing 1801703 characters, 319510 words, 4663 smileys, and 657 frowns; 2262 of those messages were ACTIONs. There have been 2404 joins, 139 parts, 1 kicks, 323 mode changes, and 129 topic changes. + @stats #sourcereview jemfinch + jemfinch has sent 16131 messages; a total of 687961 characters, 118915 words, 1482 smileys, and 226 frowns; 797 of those messages were ACTIONs. jemfinch has joined 284 times, parted 25 times, kicked someone 0 times been kicked 0 times, changed the topic 2 times, and changed the mode 2 times. + @karma #sourcereview birthday_sex + Karma for 'birthday_sex' has been increased 1 time and decreased 0 times for a total karma of 1. + @seen #sourcereview inkedmn + inkedmn was last seen here 1 day, 18 hours, 42 minutes, and 23 seconds ago saying 'ah' +""") + smileys = (':)', ';)', ':]', ':-)', ':-D', ':D', ':P', ':p', '(=', '=)') frowns = (':|', ':-/', ':-\\', ':\\', ':/', ':(', ':-(', ':\'(') diff --git a/plugins/Debian.py b/plugins/Debian.py index 0900ad208..fc2b6913d 100644 --- a/plugins/Debian.py +++ b/plugins/Debian.py @@ -30,7 +30,7 @@ ### """ -Add the module docstring here. This will be used by the setup.py script. +This is a module to contain Debian-specific commands. """ from baseplugin import * @@ -75,6 +75,15 @@ def configure(onStart, afterConnect, advanced): print 'I\'ll disable debfile now.' onStart.append('disable debfile') +example = utils.wrapLines(""" + @list Debian + debfile, debversion, usepythonzegrep + @debversion python + Total matches: 3, shown: 3. python 2.1.3-3.2 (stable), python 2.2.3-3 (testing), python 2.3-4 (unstable) + @debfile /usr/bin/python + python/python, devel/crystalspace-dev, python/python1.5, python/python2.1, python/python2.1-popy, python/python2.2, python/python2.2-popy, python/python2.3, python/python2.3-popy, devel/sloccount, graphics/pythoncad, mail/pms +""") + class Debian(callbacks.Privmsg, PeriodicFileDownloader): threaded = True diff --git a/plugins/Gameknot.py b/plugins/Gameknot.py index de64447c3..0006996cf 100644 --- a/plugins/Gameknot.py +++ b/plugins/Gameknot.py @@ -53,6 +53,18 @@ def configure(onStart, afterConnect, advanced): from questions import expect, anything, something, yn onStart.append('load Gameknot') + +example = utils.wrapLines(""" + @list Gameknot + gkstats + @gkstats jemfinch + jemfinch (team: Grasshoppers) is rated 1526 and has 0 active games and a record of W-58, L-30, D-5 (win/loss/draw %: 62.37/32.26/5.38). jemfinch was last seen on Gameknot 6 minutes ago. + blah blah blah I'm talking about http://gameknot.com/stats.pl?ddipaolo blah blah blah + ddipaolo blah blah blah (team: Grasshoppers) is rated 1159 and has 4 active games and a record of W-135, L-136, D-8 (win/loss/draw %: 48.39/48.75/2.87). ddipaolo blah blah blah was last seen on Gameknot 3 hours 48 minutes ago. + hmm, I wonder what the game http://gameknot.com/chess.pl?bd=1038943 is all about. + Challenge from ddipaolo: inkedmn (901; W-69, L-84, D-4) vs. ddipaolo (1159; W-135, L-136, D-8); inkedmn to move. +""") + class Gameknot(callbacks.PrivmsgCommandAndRegexp): threaded = True regexps = sets.Set(['gameknotSnarfer', 'gameknotStatsSnarfer']) @@ -172,11 +184,11 @@ class Gameknot(callbacks.PrivmsgCommandAndRegexp): self._gkRating.search(bRating).groups() wStats = '%s; W-%s, L-%s, D-%s' % (wRating, wWins, wLosses, wDraws) bStats = '%s; W-%s, L-%s, D-%s' % (bRating, bWins, bLosses, bDraws) - irc.queueMsg(ircmsgs.privmsg(msg.args[0], + irc.queueMsg(callbacks.reply(msg, '%s: %s (%s) vs. %s (%s); %s <%s>' % ( gameTitle, wName, wStats, bName, bStats, toMove, url))) except ValueError: - irc.queueMsg(ircmsgs.privmsg(msg.args[0], + irc.queueMsg(callbacks.reply(msg, 'That doesn\'t appear to be a proper Gameknot game.')) except Exception, e: irc.error(msg, debug.exnToString(e)) @@ -185,7 +197,7 @@ class Gameknot(callbacks.PrivmsgCommandAndRegexp): r"http://gameknot\.com/stats\.pl\?([^&]+)" name = match.group(1) s = self.getStats(name) - irc.queueMsg(ircmsgs.privmsg(msg.args[0], s)) + irc.queueMsg(callbacks.reply(msg, s)) Class = Gameknot diff --git a/plugins/Google.py b/plugins/Google.py index bd0f72664..5b24ab8f0 100644 --- a/plugins/Google.py +++ b/plugins/Google.py @@ -71,6 +71,24 @@ def configure(onStart, afterConnect, advanced): print 'You\'ll need to get a key before you can use this plugin.' print 'You can apply for a key at http://www.google.com/apis/' + +example = utils.wrapLines(""" + @list google + google, googlefight, googleinfo, googlelicensekey, googlesite, googlespell, metagoogle + @google jemfinch + [Twisted-commits] Like, you know, a bugfix. jemfinch reported.: http://twistedmatrix.com/pipermail/twisted-commits/2002-August/002956.html :: Character Analysis of JemFinch NetEssays.NET - Thousands of FREE ...: http://www.netessays.net/viewpaper/1379.html :: SourceForge.net: Developer Profile: http://sourceforge.net/users/jemfinch/ (search took 0.174663 seconds) + @googlefight jemfinch supybot moobot ddipaolo + 'moobot': 959, 'jemfinch': 236, 'ddipaolo': 229, 'supybot': 80 + @googleinfo + This google module has been called 5 times total; 5 times in the past 24 hours. Google has spent 1.229932 seconds searching for me. + @googlespell recind + rescind + @metagoogle jemfinch + Search for 'jemfinch' returned approximately 214 results in 0.072376 seconds. + @googlesite slashdot.org SCO + Slashdot | How SCO Helped Linux Go Enterprise: http://yro.slashdot.org/yro/03/07/22/0528203.shtml?tid=106&tid=185 :: Slashdot | SCO Threatens Red Hat and SuSE: http://science.slashdot.org/articles/03/04/23/1925259.shtml :: Slashdot | Linus Torvalds about SCO , IP, MS and Transmeta: http://slashdot.org/articles/03/07/05/1728201.shtml?tid=106&tid=185 (search took 0.210749 seconds) +""") + totalSearches = 0 totalTime = 0 last24hours = structures.queue() diff --git a/plugins/IMDB.py b/plugins/IMDB.py index bd4d79daa..8fe6fc057 100644 --- a/plugins/IMDB.py +++ b/plugins/IMDB.py @@ -52,6 +52,17 @@ def configure(onStart, afterConnect, advanced): from questions import expect, anything, something, yn onStart.append('load IMDB') +example = utils.wrapLines(""" + @list IMDB + imdb + @imdb die hard + "Die Hard" (1988) belongs to the action and thriller genres. It's been rated 8.0 out of 10. More information is available at + @imdb the usual suspects + "The Usual Suspects" (1995) belongs to the crime, thriller, and mystery genres. It's been rated 8.7 out of 10. More information is available at + @imdb kevin spacey + "Kevin Spacey" is apparently a person. More information is available at +""") + class IMDB(callbacks.Privmsg): threaded = True def _formatMovie(self, movie): diff --git a/plugins/Moobot.py b/plugins/Moobot.py index 8661746df..b18b71916 100644 --- a/plugins/Moobot.py +++ b/plugins/Moobot.py @@ -42,11 +42,53 @@ from baseplugin import * import re import base64 -import ircmsgs +smport ircmsgs import ircutils import privmsgs import callbacks +example = utils.wrapLines(""" + @list Moobot + cool, dawdit, ditdaw, give, hi, mime, morse, reverse, stack, unmime, unmorse + @cool supybot + :cool: supybot :cool: + @dawdit supybot + supybot + @ditdaw supybot + ... ..- .--. -.-- -... --- - + @dawdit [ditdaw supybot] + SUPYBOT + @give yourself a beer +* supybot gives himself a beer + @hi + howdy, jemfinch! + @reverse supybot + tobypus + @mime supybot + c3VweWJvdA== + @unmime [mime supybot] + supybot + @unmorse [morse supybot] + SUPYBOT + @stack push 1 + "1" pushed. + @stack push 2 + "2" pushed. + @help stack + stack <'push'|'pop'|'size'|'xray'> (for more help use the morehelp command) + @stack size + Stack size is 2. + @stack xray 1 + 2 + @stack pop + 2 + @stack pop + 1 + @stack pop + Error: Stack is empty. +""") + + class Moobot(callbacks.Privmsg): def cool(self, irc, msg, args): """ @@ -132,11 +174,17 @@ class Moobot(callbacks.Privmsg): dawdit = unmorse def hi(self, irc, msg, args): - "takes no arguments" + """takes no arguments + + Says hi to you. + """ irc.reply(msg, 'howdy, %s!' % msg.nick) def reverse(self, irc, msg, args): - "" + """ + + Reverses . + """ text = privmsgs.getArgs(args) irc.reply(msg, text[::-1]) @@ -190,7 +238,9 @@ class Moobot(callbacks.Privmsg): irc.error(msg, 'I don\'t recognize that stack command.') def give(self, irc, msg, args): - """ """ + """ + + Um, gives .""" (someone, something) = privmsgs.getArgs(args, needed=2) if someone == 'me': someone = msg.nick @@ -198,6 +248,7 @@ class Moobot(callbacks.Privmsg): someone = 'himself' response = 'gives %s %s' % (someone, something) irc.queueMsg(ircmsgs.action(ircutils.replyTo(msg), response)) + raise callbacks.CannotNest Class = Moobot diff --git a/plugins/OSU.py b/plugins/OSU.py index a53e517d1..c5be22874 100644 --- a/plugins/OSU.py +++ b/plugins/OSU.py @@ -39,6 +39,7 @@ from baseplugin import * import urllib2 import debug +import utils import privmsgs import callbacks @@ -51,6 +52,17 @@ def configure(onStart, afterConnect, advanced): from questions import expect, anything, something, yn onStart.append('load OSU') +example = utils.wrapLines(""" + @list OSU + osubuilding, osuemail + @osuemail jeremiah fincher + fincher.8@osu.edu + @osubuilding DL + Dreese Laboratories, 2015 Neil Avenue, Columbus, Ohio, 43210 + @osubuilding CE + Celeste Laboratory Of Chemistry, 120 W 18th Avenue, Columbus, Ohio, 43210 +""") + buildings = { 'AA': 'Agricultural Administration Building, ' \ '2120 Fyffe Road, Columbus, Ohio, 43210', diff --git a/plugins/Topic.py b/plugins/Topic.py index ac50a7195..7edbfebca 100644 --- a/plugins/Topic.py +++ b/plugins/Topic.py @@ -31,11 +31,6 @@ """ Provides commands for manipulating channel topics. - -Commands include: - addtopic - removetopic - shuffletopic """ from baseplugin import * @@ -50,6 +45,25 @@ import ircmsgs import privmsgs import callbacks +example = utils.wrapLines(""" +--- Topic for #sourcereview is Welcome to #sourcereview, home of cool people. (jemfinch) || supybot now has an IMDB module! (jemfinch) || jemfinch, make lasturl show more information about the url in quesiton. (jemfinch) || jemfinch, think about how you're going to have threads notify the main loop that data is ready. (jemfinch) +--- Topic for #sourcereview set by supybot at Tue Aug 26 15:38:35 + @list Topic + jemfinch: addtopic, changetopic, removetopic, shuffletopic, topic + @shuffletopic +--- supybot has changed the topic to: supybot now has an IMDB module! (jemfinch) || jemfinch, make lasturl show more information about the url in quesiton. (jemfinch) || Welcome to #sourcereview, home of cool people. (jemfinch) || jemfinch, think about how you're going to have threads notify the main loop that data is ready. (jemfinch) + @removetopic 0 +--- supybot has changed the topic to: jemfinch, make lasturl show more information about the url in quesiton. (jemfinch) || Welcome to #sourcereview, home of cool people. (jemfinch) || jemfinch, think about how you're going to have threads notify the main loop that data is ready. (jemfinch) + @changetopic 0 s/make/MAKE/ +--- supybot has changed the topic to: jemfinch, MAKE lasturl show more information about the url in quesiton. (jemfinch) || Welcome to #sourcereview, home of cool people. (jemfinch) || jemfinch, think about how you're going to have threads notify the main loop that data is ready. (jemfinch) + @removetopic -1 +--- supybot has changed the topic to: jemfinch, MAKE lasturl show more information about the url in quesiton. (jemfinch) || Welcome to #sourcereview, home of cool people. (jemfinch) + @addtopic supybot will make a beta release soon! +--- supybot has changed the topic to: jemfinch, MAKE lasturl show more information about the url in quesiton. (jemfinch) || Welcome to #sourcereview, home of cool people. (jemfinch) || supybot will make a beta release soon! (jemfinch) + @topic -1 + jemfinch: supybot will make a beta release soon! (jemfinch) +""") + class Topic(callbacks.Privmsg): topicSeparator = ' || ' topicFormatter = '%s (%s)' diff --git a/plugins/TwistedCommands.py b/plugins/TwistedCommands.py index f4fa7197d..83e466ad3 100644 --- a/plugins/TwistedCommands.py +++ b/plugins/TwistedCommands.py @@ -39,6 +39,7 @@ import re from twisted.protocols import dict +import utils import ircutils import privmsgs import callbacks @@ -50,7 +51,24 @@ def configure(onStart, afterConnect, advanced): # like to be run when the bot is started; append to afterConnect the # commands you would like to be run when the bot has finished connecting. from questions import expect, anything, something, yn - onStart.append('load TwistedCommands') + try: + import twisted + onStart.append('load TwistedCommands') + except ImportError: + print 'Sorry, you don\'t seem to have Twisted installed.' + print 'You can\'t use this module without Twisted being installed.' + print 'Once you\'ve installed Twisted, change conf.driverModule to' + print '"twistedDrivers" and add "load TwistedCommands" to your config' + print 'file.' + +example = utils.wrapLines(""" + @load TwistedCommands + The operation succeeded. + @list TwistedCommands + dict + @dict rose + adj : having a dusty purplish pink color; "the roseate glow of dawn" [syn: {roseate}, {rosaceous}] n 1: any of many plants of the genus Rosa, or pinkish table wine from red grapes whose skins were removed after fermentation began [syn: {blush wine}, {pink wine}, {rose wine}] +""") class TwistedCommands(callbacks.Privmsg): def defaultErrback(self, irc, msg): diff --git a/plugins/Unix.py b/plugins/Unix.py index dd3d4b168..88934b524 100644 --- a/plugins/Unix.py +++ b/plugins/Unix.py @@ -77,6 +77,27 @@ def configure(onStart, afterConnect, advanced): if yn('Would you like to disable this command?') == 'y': onStart.append('disable progstats') +example = utils.wrapLines(""" + @list Unix + crypt, errno, fortune, progstats, spell + @crypt jemfinch + XJsAYQVv6ACAs + @help crypt + crypt [] (for more help use the morehelp command) + @crypt jemfinch XXX + XXU51Sc5CjpkY + @errno ENOMEM + ENOMEM (#12): Cannot allocate memory + @errno 11 + EAGAIN (#11): Resource temporarily unavailable + @fortune + Q: What's the difference between Bell Labs and the Boy Scouts of America? A: The Boy Scouts have adult supervision. + @progstats + Process ID 1264 running as user "jfincher" and as group "1000" from directory "/home/jfincher/src/my/python/supybot" with the command line "src/bot.py conf/supybot.conf". Running on Python 2.3+ (#2, Aug 10 2003, 11:33:47) [GCC 3.3.1 (Debian)]. + @spell recind + Possible spellings for "recind" (26 found, 26 shown): rescind, rec ind, rec-ind, resined, rebind, remind, rewind, recent, resend, rescinds, rescinder, reined, resound, rezoned, rend, rind, reascend, recited, refined, refund, relined, repined, resins, resin, rosined, reckoned. +""") + def progstats(): pw = pwd.getpwuid(os.getuid()) response = 'Process ID %i running as user "%s" and as group "%s" '\ diff --git a/plugins/Utilities.py b/plugins/Utilities.py index c35a1ad86..8381d19ec 100644 --- a/plugins/Utilities.py +++ b/plugins/Utilities.py @@ -45,6 +45,33 @@ def configure(onStart, afterConnect, advanced): from questions import expect, anything, yn onStart.append('load Utilities') +example = utils.wrapLines(""" + @list Utilities + echo, ignore, re, repr, shrink, strconcat, strjoin, strlen, strlower, strtranslate, strupper + @echo foo bar baz + foo bar baz + @ignore foo bar baz + (he just ignores them; it's useful to run commands in sequence without caring about 'The operation succeeded' responses.) + @repr "\n" + "\n" + @eval 'x'*1000 + My response would've been too long. + @shrink [eval 'x'*1000] + 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx + (it was shrunken to 400 characters) + @strlen [shrink [eval 'x'*1000]] + 400 + @strjoin + foo bar baz + foo+bar+baz + @strlower FOO BAR BAZ + foo bar baz + @strupper FOO bar baz + FOO BAR BAZ + @strtranslate abc def "abc is easy as 123" + def is edsy ds 123 + @strconcat foo bar +""") + class Utilities(callbacks.Privmsg): def ignore(self, irc, msg, args): """takes no arguments