pulled apart duplicate code in querying the bot