Fixed bug in whois
This commit is contained in:
parent
036794e50a
commit
2d283cf240
|
@ -47,8 +47,19 @@ module.exports = class Whois {
|
|||
"Authorization": `${apiKey}`
|
||||
}
|
||||
}).then((res) => {
|
||||
const status = res.data.registrar.id ? "registered" : "available";
|
||||
self.client.say(self.channel, `${domain} is "${status}"`);
|
||||
// const data = JSON.stringify(res.data);
|
||||
// console.log(`${self.name} :: ${data}`);
|
||||
const nameservers = res.data.nameservers.length;
|
||||
const registrar = res.data.registrar;
|
||||
const registered = res.data.registered;
|
||||
if (registered) {
|
||||
const logic = registrar.id || nameservers > 0;
|
||||
const status = logic ? "registered" : "available";
|
||||
self.client.say(self.channel, `${domain} is "${status}"`);
|
||||
} else {
|
||||
const zipper = `${this.summoner}, vi zipro, ${domain}`;
|
||||
self.client.say(self.channel, `${zipper} is not a domain!`);
|
||||
}
|
||||
}).catch((error) => {
|
||||
const zipper = `${this.summoner}, vi zipro, ${domain}`;
|
||||
self.client.say(self.channel, `${zipper} cannot exist!`);
|
||||
|
|
Loading…
Reference in New Issue