mirror of
https://codeberg.org/emersion/gamja.git
synced 2024-11-25 08:48:09 -05:00
Add /unban
This commit is contained in:
parent
a2dc045683
commit
291c9e177d
1 changed files with 14 additions and 12 deletions
26
commands.js
26
commands.js
|
@ -17,26 +17,21 @@ function getActiveChannel(app) {
|
||||||
return activeBuffer.name;
|
return activeBuffer.name;
|
||||||
}
|
}
|
||||||
|
|
||||||
function ban(app, args) {
|
function setUserHostMode(app, args, mode) {
|
||||||
var nick = args[0];
|
var nick = args[0];
|
||||||
if (!nick) {
|
if (!nick) {
|
||||||
throw new Error("Missing nick");
|
throw new Error("Missing nick");
|
||||||
}
|
}
|
||||||
var activeChannel = getActiveChannel(app);
|
var activeChannel = getActiveChannel(app);
|
||||||
var params = [activeChannel, nick];
|
var client = getActiveClient(app);
|
||||||
if (args.length > 1) {
|
|
||||||
params.push(args.slice(1).join(" "));
|
|
||||||
}
|
|
||||||
const client = getActiveClient(app);
|
|
||||||
client.whois(nick).then((whois) => {
|
client.whois(nick).then((whois) => {
|
||||||
const info = whois[irc.RPL_WHOISUSER].params;
|
const info = whois[irc.RPL_WHOISUSER].params;
|
||||||
const user = info[2];
|
const user = info[2];
|
||||||
const host = info[3];
|
const host = info[3];
|
||||||
client.send({ command: "MODE", params: [
|
client.send({
|
||||||
activeChannel,
|
command: "MODE",
|
||||||
"+b",
|
params: [activeChannel, mode, `*!${user}@${host}`],
|
||||||
`*!${user}@${host}`
|
});
|
||||||
]});
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -91,7 +86,7 @@ export default {
|
||||||
params: [activeChannel, "+b"],
|
params: [activeChannel, "+b"],
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
return ban(app, args);
|
return setUserHostMode(app, args, "+b");
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
@ -321,6 +316,13 @@ export default {
|
||||||
getActiveClient(app).send({ command: "TOPIC", params });
|
getActiveClient(app).send({ command: "TOPIC", params });
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
"unban": {
|
||||||
|
usage: "<nick>",
|
||||||
|
description: "Remove a user from the ban list",
|
||||||
|
execute: (app, args) => {
|
||||||
|
return setUserHostMode(app, args, "-b");
|
||||||
|
},
|
||||||
|
},
|
||||||
"voice": {
|
"voice": {
|
||||||
usage: "<nick>",
|
usage: "<nick>",
|
||||||
description: "Gives a user voiced status on this channel",
|
description: "Gives a user voiced status on this channel",
|
||||||
|
|
Loading…
Reference in a new issue