dbot icon indicating copy to clipboard operation
dbot copied to clipboard

Automatic Quote Addition

Open SamStudio8 opened this issue 12 years ago • 4 comments

Allow users (probably moderators) to specify regular expressions that will automatically add matching lines to a specified quote category.

SamStudio8 avatar Feb 15 '13 17:02 SamStudio8

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?

johnmaguire avatar Mar 19 '13 20:03 johnmaguire

@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.

SamStudio8 avatar Mar 19 '13 20:03 SamStudio8

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.)

johnmaguire avatar Mar 19 '13 21:03 johnmaguire

Worth noting, if this is added with callbacks, lines 91-102 of quotes.js can be removed.

johnmaguire avatar Mar 20 '13 21:03 johnmaguire