Skip to content

Instantly share code, notes, and snippets.

@jfred
Created January 8, 2017 19:36
Show Gist options
  • Save jfred/dfc1168db03f577f2c7952d9c6ec3438 to your computer and use it in GitHub Desktop.
Save jfred/dfc1168db03f577f2c7952d9c6ec3438 to your computer and use it in GitHub Desktop.
Dumb bookmarklet function for setting Slack DND until Monday morning
(function() {
var slackToken = 'GET TOKEN FROM https://api.slack.com/docs/oauth-test-tokens';
var targetHr = 9;
var d = new Date();
d.setDate(d.getDate() + (1 + 7 - d.getDay()) % 7);
d.setHours(targetHr); d.setMinutes(0); d.setSeconds(0);
var mins = (d.getTime()-new Date().getTime()) / (1000 * 60);
window.location='https://slack.com/api/dnd.setSnooze?token=' + slackToken + '&num_minutes=' + mins + '&pretty=1';
})()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment