forked from CringeStudios/gamja
Add support for /ban without argument
This commit is contained in:
parent
5004f6c89c
commit
a4294975a2
27
commands.js
27
commands.js
@ -9,10 +9,7 @@ function getActiveClient(app) {
|
||||
return app.clients.get(buf.network);
|
||||
}
|
||||
|
||||
const ban = {
|
||||
usage: "<nick>",
|
||||
description: "Bans a user from the channel",
|
||||
execute: (app, args) => {
|
||||
function ban(app, args) {
|
||||
var nick = args[0];
|
||||
if (!nick) {
|
||||
throw new Error("Missing nick");
|
||||
@ -36,8 +33,7 @@ const ban = {
|
||||
`*!${user}@${host}`
|
||||
]});
|
||||
});
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const join = {
|
||||
usage: "<name>",
|
||||
@ -84,7 +80,24 @@ function givemode(app, args, mode) {
|
||||
}
|
||||
|
||||
export default {
|
||||
"ban": ban,
|
||||
"ban": {
|
||||
usage: "[nick]",
|
||||
description: "Bans a user from the channel, or displays the current ban list",
|
||||
execute: (app, args) => {
|
||||
if (args.length == 0) {
|
||||
var activeBuffer = app.state.buffers.get(app.state.activeBuffer);
|
||||
if (!activeBuffer || !app.isChannel(activeBuffer.name)) {
|
||||
throw new Error("Not in a channel");
|
||||
}
|
||||
getActiveClient(app).send({
|
||||
command: "MODE",
|
||||
params: [activeBuffer.name, "+b"],
|
||||
});
|
||||
} else {
|
||||
return ban(app, args);
|
||||
}
|
||||
},
|
||||
},
|
||||
"buffer": {
|
||||
usage: "<name>",
|
||||
description: "Switch to a buffer",
|
||||
|
@ -898,6 +898,11 @@ export default class App extends Component {
|
||||
}
|
||||
});
|
||||
break;
|
||||
case irc.RPL_BANLIST:
|
||||
case irc.RPL_ENDOFBANLIST:
|
||||
var channel = msg.params[1];
|
||||
this.addMessage(netID, channel, msg);
|
||||
break;
|
||||
case "CAP":
|
||||
case "AUTHENTICATE":
|
||||
case "PING":
|
||||
|
@ -17,6 +17,8 @@ export const RPL_TOPICWHOTIME = "333";
|
||||
export const RPL_WHOREPLY = "352";
|
||||
export const RPL_NAMREPLY = "353";
|
||||
export const RPL_ENDOFNAMES = "366";
|
||||
export const RPL_BANLIST = "367";
|
||||
export const RPL_ENDOFBANLIST = "368";
|
||||
export const RPL_MOTD = "372";
|
||||
export const RPL_MOTDSTART = "375";
|
||||
export const RPL_ENDOFMOTD = "376";
|
||||
|
Loading…
x
Reference in New Issue
Block a user