Migrate to async/await
This commit is contained in:
parent
57f64e9cc2
commit
535bdb2f52
3 changed files with 124 additions and 132 deletions
17
commands.js
17
commands.js
|
@ -25,21 +25,20 @@ function getActiveChannel(app) {
|
|||
return activeBuffer.name;
|
||||
}
|
||||
|
||||
function setUserHostMode(app, args, mode) {
|
||||
async function setUserHostMode(app, args, mode) {
|
||||
let nick = args[0];
|
||||
if (!nick) {
|
||||
throw new Error("Missing nick");
|
||||
}
|
||||
let activeChannel = getActiveChannel(app);
|
||||
let client = getActiveClient(app);
|
||||
client.whois(nick).then((whois) => {
|
||||
const info = whois[irc.RPL_WHOISUSER].params;
|
||||
const user = info[2];
|
||||
const host = info[3];
|
||||
client.send({
|
||||
command: "MODE",
|
||||
params: [activeChannel, mode, `*!${user}@${host}`],
|
||||
});
|
||||
let whois = await client.whois(nick);
|
||||
const info = whois[irc.RPL_WHOISUSER].params;
|
||||
const user = info[2];
|
||||
const host = info[3];
|
||||
client.send({
|
||||
command: "MODE",
|
||||
params: [activeChannel, mode, `*!${user}@${host}`],
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue