jakenotjacob / tokbot

IRC factoid bot with plugin functionality.
MIT License
2 stars 1 forks source link

Factoids with arguments #6

Open jakenotjacob opened 9 years ago

jakenotjacob commented 9 years ago

As Symmetry pointed out, it would be nice to have factoids also accept optional arguments to restrain unnecessary information. IE -- "!battery 25r" would show all pertinent information (possibly: description, specs, links), but the more explicit "!battery 25r price" would be available as well.

Might need to look into if factoids need categories... ("!25r ..." vs "!battery 25r ...".)

symmetryrtemmys commented 8 years ago

An elegant way to handle this would to change the way that factoids are stored and added. When adding a factoid, use !add battery $1 $model ║ $wrap ║ $capacity ║ $voltage ║ $amps ║ $specs and then !add battery 25r Samsung INR18650-25R-R5 ║ Wrap color: Green ║ 2500mAh ║ 2.5V/3.6V/4.2V ║ 20A ║ http://www.powerstream.com/p/INR18650-25R-datasheet.pdf - so if the regex pattern matches (in this case, ║ .* ║) then fill in the variables accordingly.

You can use any of the $string lookups as well, so:

!battery 25r outputs Samsung INR18650-25R-R5 ║ Wrap color: Green ║ 2500mAh ║ 2.5V/3.6V/4.2V ║ 20A ║ http://www.powerstream.com/p/INR18650-25R-datasheet.pdf

!battery 25r wrap outputs Wrap color: Green

The help file should show the template structure when service-style help files are implemented.

Since vapebot is now SQL-based, this sort of flexible array should be possible. I don't know SQL that well, though, so if I'm wrong, my idea may not work at all.

jakenotjacob commented 8 years ago

@symmetryrtemmys Sorry for the untimely response! Haven't touched vapebot in awhile. But I definitely agree, and it's definitely do-able. I'll look into it this week and keep you updated in the IRC channel.