Refactored to create functions, fix race possible race condition with mongoDB connect.
Refactored to create functions, fix race possible race condition with mongoDB connect.

EliKrumholz/botkit,cbuehnerkemper/botkit-copy,dcortes22/picnic,gabrielfirmacion/frontdoor-demo,ouadie-lahdioui/botkit,pickettd/slack-oregon-trail,adam-nnl/omgwtfbbq-bot,healthchatnow/hcn,stopsatgreen/botkit-messenger,acrollet/botkit,grindcore819/slackathonMTL,twhit027/lewd-bot,howdyai/botkit,stopsatgreen/botkit-slack,DJ1K1/botkit,howdyai/botkit,DJ1K1/botkit,myochum/Triviabot,howdyai/botkit,samuelsan/YelpBot,tmtkg/botkit,howdyai/botkit,dhulser/slack-reporting-bot