Skip to content
Open
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
23 changes: 23 additions & 0 deletions bot/commands/fun/issmithavailableyet.js
Original file line number Diff line number Diff line change
@@ -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...');
});
};