dbot
dbot copied to clipboard
Automatic Quote Addition
Allow users (probably moderators) to specify regular expressions that will automatically add matching lines to a specified quote category.
To get an idea of the point of this, is this to add support for lines like "android is a phone os" to save information under ~android? If I'm remember correctly, some popular Perl bot does this. Or am I misunderstanding the use case for this?
@JohnMaguire2013 The idea would be that a command would take the parameters of a regular expression and a quote category for matching lines to be added to. So taking your example;
~autoq [a|A]ndroid android
Would add a regular expression to add any mentions of Android to the relevant category. Although I imagine we'd need to cleverly delimit or escape certain characters in the command, as both the regex and the category names could contain spaces which would cause the event.params to become rather confused.
Ah. I understand. I think it might be neat (though perhaps not feasible) to also make something like this possible:
~autoq "(.+?) is (.+)" $1
This syntax would save "Android is a mobile operating system" to "android". Not actually sure if it would be too useful behind that use case, or whether callbacks are really feasible for this module, but it would give a lot more flexibility to the command.
As far as clever delimiting goes, you could simply requires quotes or parenthesis around the regex (or the category title.)
Worth noting, if this is added with callbacks, lines 91-102 of quotes.js can be removed.