msg.tostring lool

This commit is contained in:
Flummi 2019-08-22 10:45:42 +00:00
parent db5b5c36a5
commit acf7ac3d49

View File

@ -84,9 +84,9 @@ export default class irc extends EventEmitter {
} }
sendmsg(mode, recipient, msg) { sendmsg(mode, recipient, msg) {
msg = Array.isArray(msg) ? msg : msg.split(/\r?\n/); msg = Array.isArray(msg) ? msg : msg.split(/\r?\n/);
if (msg.length > 6) if (msg.length >= 5)
return this.emit("data", ["error", "too many lines"]); return this.emit("data", ["error", "too many lines"]);
msg.forEach(e => this.send( msgmodes[mode].replace("{recipient}", recipient).replace("{msg}", this.format(e)) )); msg.forEach(e => this.send( msgmodes[mode].replace("{recipient}", recipient).replace("{msg}", this.format(e.toString())) ));
} }
parse(data, [a, ...b] = data.split(/ +:/), tmp = a.split(" ").concat(b)) { parse(data, [a, ...b] = data.split(/ +:/), tmp = a.split(" ").concat(b)) {
const prefix = data.charAt(0) === ":" ? tmp.shift() : null const prefix = data.charAt(0) === ":" ? tmp.shift() : null