Pull Different Item From List Depending on Query

Hi all,

Not sure if it is possible to do since Nightbot doesn’t work with databases (not easily at least) but I’m hoping to create a command that pulls a line from a PasteBin list depending on a query filter. For example, I have a list of foods:

  • beef
  • chicken
  • lettuce
  • carrot
  • apple
  • orange

If I type in “!food meat” or “!food vegetables” or “!food fruit” it should return one of options in that category.

If we would need to add a “filter statement” at the beginning or end of each option like “beef - meat” that would be acceptable. If possible, I would also like !food to pull any option from the list. If need be I can create separate commands for the categorized query options as long as the original !food doesn’t override the others. Thank you!

Hey @brandanlovesyou!

It all depends on how you build/built your database, but at first glance it’s possible, I’ve done similar things before.
You can use JavaScript on Nightbot thanks to its $(eval) variable.

You’ll have to give us much more details if you wish to get our help tho’.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.