Factoids
Documentation for the Factoids plugin for Supybot
Purpose
Handles factoids, little tidbits of information held in a database and
available on demand via several commands.
Commands
- change [<channel>] <key> <number>
<regexp>
Changes the factoid #<number> associated with <key> according to <regexp>.
- forget [<channel>] <key>
[<number>|*]
Removes the factoid <key> from the factoids database. If there are more than one factoid with such a key, a number is necessary to determine which one should be removed. A * can be used to remove all factoids associated with a key. <channel> is only necessary if the message isn't sent in the channel itself.
- info [<channel>] <key>
Gives information about the factoid(s) associated with <key>. <channel> is only necessary if the message isn't sent in the channel itself.
- learn [<channel>] <key> as <value>
Associates <key> with <value>. <channel> is only necessary if the message isn't sent on the channel itself. The word
asis necessary to separate the key from the value. It can be changed to another word via the learnSeparator registry value. - lock [<channel>] <key>
Locks the factoid(s) associated with <key> so that they cannot be removed or added to. <channel> is only necessary if the message isn't sent in the channel itself.
- random [<channel>]
Returns a random factoid from the database for <channel>. <channel> is only necessary if the message isn't sent in the channel itself.
- search [<channel>] [--values] [--{regexp}
<value>] [<glob> ...]
Searches the keyspace for keys matching <glob>. If --regexp is given, it associated value is taken as a regexp and matched against the keys. If --values is given, search the value space instead of the keyspace.
- unlock [<channel>] <key>
Unlocks the factoid(s) associated with <key> so that they can be removed or added to. <channel> is only necessary if the message isn't sent in the channel itself.
- whatis [<channel>] <key> [<number>]
Looks up the value of <key> in the factoid database. If given a number, will return only that exact factoid. <channel> is only necessary if the message isn't sent in the channel itself.
Configuration
- supybot.plugins.Factoids.public
This config variable defaults to True and is not channel specific.
Determines whether this plugin is publicly visible.
- supybot.plugins.Factoids.learnSeparator
This config variable defaults to "as" and is channel specific.
Determines what separator must be used in the learn command. Defaults to
as-- learn <key> as <value>. Users might feel more comfortable withisor something else, so it's configurable. - supybot.plugins.Factoids.showFactoidIfOnlyOneMatch
This config variable defaults to True and is channel specific.
Determines whether the bot will reply with the single matching factoid if only one factoid matches when using the search command.
- supybot.plugins.Factoids.replyWhenInvalidCommand
This config variable defaults to True and is channel specific.
Determines whether the bot will reply to invalid commands by searching for a factoid; basically making the whatis unnecessary when you want all factoids for a given key.
- supybot.plugins.Factoids.factoidPrefix
This config variable defaults to "could be " and is channel specific.
Determines the string that factoids will be introduced by.
I found a way to emulate that command with the Factoid plugin. Just run these two commands:
alias add tell "Misc tell $1 [Factoid whatis $2]"
defaultplugin tell Alias
The first one defines a "tell" command. The brackets ([...]) tell the parser to actually 'run' the command in brackets. The second command tells supybot that the alias "tell" has a higher priority than the "tell" command in the Misc plugin. Otherwise built-in commands have a higher priority than aliases.
In the channel you can then write "!tell jamessan faq". The bot will then tell jamessan privately about that factoid. In case there is no factoid like that you will get a "Error: No factoid matches that key." in the channel.
Perhaps it would still be nicer if there were a "tell" command built into the Factoids plugin.
(thanks to the kind people in #supybot for their help)
Replies to this comment