Skip to content
This repository has been archived by the owner on Jun 8, 2023. It is now read-only.

Fix 'sendgrid today' api call #1185

Merged
merged 1 commit into from
Oct 11, 2013
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion src/scripts/sendgrid.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ module.exports = (robot) ->
if env.HUBOT_SENDGRID_USER and env.HUBOT_SENDGRID_KEY
robot.respond /(sendgrid)( me)? today/i, (msg) ->
opts =
days: 0
start_date: getTodayStr
query msg, opts, (json) ->
msg.send formatResponse(json[0], json[0].date)

Expand Down Expand Up @@ -128,3 +128,10 @@ formatResponse = (json, header) =>
" #{description}: #{json[stat]}"
details.unshift "Stats for #{header}:"
details.join("\n")

getTodayStr = () =>
today = new Date();
cur_day = today.getDate()
cur_month = today.getMonth() + 1
cur_year = today.getFullYear()
tdy_string = cur_year + "-" + cur_month + "-" + cur_day