Send all modes in case of no ISUPPORT

This commit is contained in:
JeDaYoshi 2021-07-06 15:48:01 +00:00
parent 23f6886cc1
commit d96704835a
No known key found for this signature in database
GPG Key ID: 8060B288C274219D
2 changed files with 5 additions and 3 deletions

View File

@ -42,7 +42,7 @@ exports.input = function ({irc, nick}, chan, cmd, args) {
devoice: "-v",
}[cmd];
const limit = parseInt(irc.network.supports("MODES")) || 1;
const limit = parseInt(irc.network.supports("MODES")) || target.length;
for (let i = 0; i < target.length; i += limit) {
const targets = target.slice(i, i + limit);

View File

@ -118,12 +118,14 @@ describe("Commands", function () {
expect(testableNetwork.lastCommand).to.equal("MODE #thelounge -v thelounge");
});
it("should fallback to default limit of 1 mode for shorthand commands", function () {
it("should fallback to all modes at once for shorthand commands", function () {
ModeCommand.input(testableNetworkNoSupports, channel, "voice", ["xPaw"]);
expect(testableNetworkNoSupports.lastCommand).to.equal("MODE #thelounge +v xPaw");
ModeCommand.input(testableNetworkNoSupports, channel, "devoice", ["xPaw", "Max-P"]);
expect(testableNetworkNoSupports.lastCommand).to.equal("MODE #thelounge -v Max-P");
expect(testableNetworkNoSupports.lastCommand).to.equal(
"MODE #thelounge -vv xPaw Max-P"
);
});
});
});