Today was all about new features for the bot. I updated the /search-user [USER ID] function from Friday so that it would better handle errors and improper usage, and created /nearby-refs [ZIP CODE] [SPORT] command to find users living within thirty miles of a input zip code, who are credentialed for a particular sport. The database code behind this one is pretty complicated, because it actually calls a second database that holds latitude and longitude information for zip codes, converts the distance to miles, then checks if that distance is under 30 miles. There were a few errors where the correct information wasn’t being pulled from the database but it only took a few minutes to find out where the problem resided.
At this point I realized that the layout and readability of the code was getting particularly poor, so I spent a while time on re-organizing it to flow better, commenting the functions fully, and adding more user help commands.
The rest of the day was spend adding more commands:
/silbo: Returns a list of all commands and their descriptions
/predict-power-users: Returns the number of new power users if all games are run as they are currently filled
/predict-active-users: Returns the number of new active users if all games are run as they are currently filled
/checked-game: Returns the name, email, and phone number of all refs to have checked a specific game
/open-games: Returns a list of all open games, their ID number, their sport, and their zip code