LakeYS / Discord-Trivia-Bot

TriviaBot: Play trivia in Discord! Powered by discord.js and OpenTDB, with 24 categories and three modes of play.
Apache License 2.0
84 stars 39 forks source link

Handling for category names with sequential numbers #251

Open LakeYS opened 2 years ago

LakeYS commented 2 years ago

From Discord:

I have a question that I've been meaning to ask for a while, regarding category names. I'm attaching a screenshot of the list of categories I'm using for my self-hosted instance. Regarding categories 3 through 13: I originally had the numbers only in word form, but since users kept trying "trivia play 8" instead of "trivia play eight", I thought I'd be smart and add numeric form to the category name so they could theoretically use either word or number format to play the category of choice. (Sometimes they would do "trivia play 2018" or whatever and go by the year instead, which also worked - except for the cases where the years overlapped differently, in which case it selected the first category with that year [search term].) However, I was surprised to find that the bot does not recognize "1" through "10" as acceptable names of categories. Do you have an explanation for why the low numbers don't register as part of the category name?

image

Relevant code: https://github.com/LakeYS/Discord-Trivia-Bot/blob/master/lib/database/database.js#L18