TotallyNotRobots/CloudBot

.urban fails if query end in a numeric character

Closed this issue · 1 comments

.urban fails if query end in a numeric character. For example, the following command will return no results, despite there being an entry for it in urban dictionary:

.urban 999

The problem lies on line #27 of \plugins\urban.py:

 # if the last word is a number, set the ID to that number
 if parts[-1].isdigit():

It then removes the number from the input string, resulting in an empty query.
However, it doesn't check if the word is the only word, in which case it is the query, not the definition number.

The solution, then is to replace line #27 with this:
if parts[-1].isdigit() and len(parts) > 1:

I have already made this fix/change. I am creating this ticket to go with my pull request.

Closed by 9692058