Commit Graph

7282 Commits

Author SHA1 Message Date
Daniel Folkinshteyn b12d8a8a04 Use the ircutils.standardSubsitute function upon factoid output.
This allows inclusion of the usual standardSubstitute vars within factoids.

There is no config to disable this, since it is possible to escape the substitutions
by simply doubling the dollar signs, as per the python documentation:
http://docs.python.org/library/string.html#template-strings

Thus, if you want a factoid to output a literal "$channel", for example, all
you'd need to do is use "$$channel" in your factoid text, which will come out
as "$channel" when said by the bot.

Also added tests for this new behavior.
2011-02-25 19:18:02 +01:00
Daniel Folkinshteyn 8ed94257ba some enhancements Factoids.rank:
output options: plain key output, and alpha sorting for plain output.
allow an optional argument for how many ranked facts to show.
2011-02-25 19:16:48 +01:00
Daniel Folkinshteyn 7c3bc67c86 Add some sanity checks to RSS plugin:
First: if an rss feed is called without the number of headlines argument,
we now have a default number of items it will output.
before, it tried to stuff the whole rss feed into the channel, which is quite
floody, if more than one 'mores' is set, or if oneToOne is false.

Second: when adding a new feed to announce, it again, tried to stuff the
whole rss feed into the channel, which ran into the same floody conditions
as above. now we have a default number of feeds to output when there's no
cached history.
2011-02-25 19:15:41 +01:00
Daniel Folkinshteyn 7505f839fc fix docstring for Plugin.plugin command so it actually says what the command will do.
also add a Plugin.plugins command, which always returns a list of all plugins containing a command.
add a test for it.
2011-02-25 19:14:35 +01:00
Daniel Folkinshteyn 92fc1e308f update quotegrabs to sqlite3 2011-02-25 19:14:06 +01:00
James Vega 4af9d8735f Make registry.Regexp.error mimic registry.Value.error
Regexp.error can't directly call Value.error because it's providing extra
information, so it needs to build the InvalidRegistryValue exception itself
and raise it.

Closes: Sf#2985241

Signed-off-by: James Vega <jamessan@users.sourceforge.net>
(cherry picked from commit ef8bd817e8)

Signed-off-by: Daniel Folkinshteyn <nanotube@users.sourceforge.net>
2011-02-25 19:13:57 +01:00
Daniel Folkinshteyn 73e822ca56 Undo mtughan's bugfix from 7f9a113060, so i can merge jamessan's fix ef8bd817e8 2011-02-25 19:13:50 +01:00
Daniel Folkinshteyn d433bfc8f0 for Factoids: make approximate fuzzy key searches also when invoking whatis directly.
also add tests.
while there, remove useless config setting for replyinvalidcommand testing, since it is true by default.
2011-02-25 19:13:27 +01:00
Daniel Folkinshteyn e939cfd124 update Karma plugin and test code to use sqlite3.
This involved also updating src/conf.py to look for sqlite3 and add it to supybot.conf.databases list,
since karma uses the plugins.DB() constructor for its database, which checks the available databases list.
2011-02-25 19:11:58 +01:00
Daniel Folkinshteyn bf6f0e2d18 make google translate return detailed google error, instead of the unhelpful "we broke google". 2011-02-25 18:56:56 +01:00
Daniel Folkinshteyn 8d45228642 for google translate, error if destination language is 'auto'. 2011-02-25 18:56:50 +01:00
Daniel Folkinshteyn 261a646451 in Later nick validation, use irc.isNick. now instead of forcing strictRfc to true, we are using the config. 2011-02-25 18:56:40 +01:00
Daniel Folkinshteyn e46948400d take out getDb override from factoids, since i have changed it upstream, in plugins.__init__.py, to use proper sqlite3 syntax. 2011-02-25 18:54:51 +01:00
Daniel Folkinshteyn 1b0aa48368 make on-join telling for later configurable. 2011-02-25 18:54:30 +01:00
Daniel Folkinshteyn e68704a0fc topic now checks for +t mode before denying topic changes, and also allows halfops in addition to ops.
default required capabilities for topic changes (if topic is +t and user is not an op or halfop), are chan,op and chan,halfop
thanks jemfinch for the suggestions.
2011-02-25 18:53:11 +01:00
Daniel Folkinshteyn dae8dfd2e7 add replace function to format that takes varying-length strings to replace.
add test for it
add error test for format.translate for different length translate args.
2011-02-25 18:49:39 +01:00
Daniel Folkinshteyn 2d718d31bb Fix factoids bug ,Factoids.showFactoidIfOnlyOneMatch feature is broken when used off-channel:
https://sourceforge.net/tracker/?func=detail&aid=2965589&group_id=58965&atid=489447
2011-02-25 18:48:56 +01:00
Daniel Folkinshteyn 4cd0d19be7 commit mtughan's bugfix for this bug:
https://sourceforge.net/tracker/?func=detail&aid=2985241&group_id=58965&atid=489447
2011-02-25 18:48:46 +01:00
Daniel Folkinshteyn c0986e1122 change Topic to have a default required capability set, for all write operations.
by default, now only allows chanops, and users with admin or channel,op capability to change topics
2011-02-25 18:47:56 +01:00
Daniel Folkinshteyn 7ec1ca2070 make later plugin send waiting messages on user join also, not just on privmsg. 2011-02-25 18:38:14 +01:00
Daniel Folkinshteyn fcaa7863fa add nick validation to later tell
this avoids plugging the later db with messages for bogus nicks
2011-02-25 18:37:22 +01:00
Daniel Folkinshteyn a2da24d202 add a random-synonym getting function to Dict, add tests for it.
using the moby-thes database from dict.org.
2011-02-25 18:36:17 +01:00
Daniel Folkinshteyn b306c5440f add damerau-levenshtein distance to supybot.utils.seq
use it in factoids invalid command to match possible typos
write tests for same.
2011-02-25 18:36:09 +01:00
Daniel Folkinshteyn bdc8fd5285 fix some encoding error for non-ascii langs 2011-02-25 18:36:00 +01:00
Daniel Folkinshteyn ca045128d7 add detected source language display for 'auto' google translate, add test for auto translate. 2011-02-25 18:35:53 +01:00
Daniel Folkinshteyn 6b324674a7 enable google translate to autodetect language with 'auto' fromlang. 2011-02-25 18:35:44 +01:00
Daniel Folkinshteyn 9b516480af add tests for factoids.alias 2011-02-25 18:35:37 +01:00
Daniel Folkinshteyn 50ac5a05e1 delete leftover debug-prints 2011-02-25 18:35:30 +01:00
Daniel Folkinshteyn 366c2b7c17 add factoids alias function, to link more keys to existing factoids. 2011-02-25 18:35:17 +01:00
Daniel Folkinshteyn 436d2bade8 mod factoids plugin to use a separate key-value relationship table
this avoids duplication, and allows one to set a bunch of aliases for a factoid, without creating duplicates of the same fact content.
2011-02-25 18:33:40 +01:00
Daniel Folkinshteyn 471921eab6 make 'factoids info' include usage count in output. add test for same. 2011-02-24 21:03:30 +01:00
nanotube e71ee8fbb1 don't give up too easily with invalid command, instead search factoid keys with wildcard first. 2011-02-24 21:02:39 +01:00
nanotube b922890b6f add rank test to factoids, update factoids test code to sqlite3 2011-02-24 21:01:19 +01:00
nanotube 5c0596f484 rename factrank to just rank for consistency 2011-02-24 21:01:08 +01:00
Daniel Folkinshteyn 2b5ffaa940 add replies function to reply plugin, which makes multiple replies, if supybot.reply.oneToOne is false. 2011-02-24 20:58:05 +01:00
Daniel Folkinshteyn f71464adb3 This merges an old branch i had for sqlite3 factoids+moobotfactoids.
fix up moobotfactoids+factoids to use the sqlite text_factory=str,
also fixed up a test for factoid search, since it now sorts keys alphabetically.
2011-02-24 20:55:24 +01:00
Daniel Folkinshteyn c0ebdddb47 start factoid rankings from 1 not from 0 2011-02-24 20:09:00 +01:00
Daniel Folkinshteyn 34f8557cfd remove rogue test-print 2011-02-24 20:06:35 +01:00
Daniel Folkinshteyn 7351ec1702 sort keys in factoid search output by alphabetically by key name. 2011-02-24 20:03:28 +01:00
Daniel Folkinshteyn d2ac0e742a implement factoid usage counter 2011-02-24 20:03:03 +01:00
Daniel Folkinshteyn 957998f483 Utilities: add countargs function, returns number of arguments supplied.
also add tests for it.
2011-02-20 11:30:50 +01:00
Daniel Folkinshteyn 6381266cfd Utilities: add 'sample' command, a basic interface to random.sample()
Also add tests for it.
2011-02-20 11:29:08 +01:00
Valentin Lorentz 9d7287a436 Import MessageParser from gribble repo 2011-02-20 11:14:29 +01:00
Valentin Lorentz f3a20df8f1 Import Conditional from gribble repo 2011-02-20 11:13:57 +01:00
Daniel Folkinshteyn f6e3698c24 Scheduler: handle event persistence on plugin reload.
Write data to disk on unload; populate events dict with events which are
still scheduled on reload.
2011-02-20 10:43:02 +01:00
Daniel Folkinshteyn 42efc79ef1 Scheduler: add scheduled task persistence.
The list of tasks scheduled with the Scheduler plugin is now saved
on exit, and restored upon restart.

Previously all scheduled tasks would be forgotten upon bot restart,
which was undesirable behavior.
2011-02-20 10:41:52 +01:00
Valentin Lorentz 2d265f9d82 Google: update translation 2011-02-14 18:35:53 +01:00
Daniel Folkinshteyn a6b9d5fe5f Google: fix encoding bug in lucky --snippet; need to pass encoded string to utils.web.htmlToText 2011-02-14 18:27:40 +01:00
Daniel Folkinshteyn 614e6c3f43 Google: in lucky --snippet, properly convert html to text, using utils.web.htmlToText. 2011-02-14 18:27:26 +01:00
Daniel Folkinshteyn 33c6eabf82 Google: add --snippet option to lucky command, which shows the text snippet for the page. 2011-02-14 18:26:50 +01:00