Last active
August 24, 2020 16:22
-
-
Save Algo-ryth-mix/0b6a386fae4e6b808018f2cdce6a8c3e to your computer and use it in GitHub Desktop.
The seconds to midnight on the doomsday clock in a handy littel discord bot
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* see below for license (ISC) */ | |
/* requires: | |
- discord.js ($ npm install discord.js) | |
- minutes-to-midnight ($ npm install minutes-to-midnight) | |
*/ | |
const Discord = require('discord.js'); | |
const client = new Discord.Client(); | |
const m2m = require('minutes-to-midnight'); | |
client.on('ready', () => { | |
console.log(`Logged in as ${client.user.tag}!`); | |
}) | |
client.on('message', msg => { | |
if(msg.content === '$\\doomsday' || msg.content === '$/doomsday' || | |
msg.content === `$\\midnight` || msg.content === '$/midnight') { | |
msg.reply(`It is ${m2m.getTimeToMidnight()} to midnight on the doomsday-clock!`); | |
} | |
}) | |
client.login('<your-bot-token-here>') | |
/* | |
Copyright 2020 Raphael Baier | |
Permission to use, copy, modify, and/or distribute this software for any | |
purpose with or without fee is hereby granted, provided that the above | |
copyright notice and this permission notice appear in all copies. | |
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR | |
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment