diff --git a/bot/commands/fun/issmithavailableyet.js b/bot/commands/fun/issmithavailableyet.js new file mode 100644 index 0000000..d2cd1d2 --- /dev/null +++ b/bot/commands/fun/issmithavailableyet.js @@ -0,0 +1,23 @@ +'use strict'; + +/** + * @param {DubAPI} bot + */ +module.exports = function(bot) { + fetch('https://api.queup.net/user/query/availabilty?username=smith') // this endpoint has a typo, lol + .then(res => { + if (res.ok) return res.json(); + else throw new Error(res.status.toString()); + }) + .then(json => { + if (json.data.taken) { + bot.sendChat('No, someone still has the username Smith :rage:'); + } else { + bot.sendChat(':exclamation: THE USERNAME SMITH IS AVAILABLE :exclamation:'); + } + }) + .catch(err => { + bot.log('error', 'BOT', `[!issmithavailableyet] ${err.message}`); + bot.sendChat('Bad request to username availability check...'); + }); +}; \ No newline at end of file