modified: src/clients/irc.mjs
This commit is contained in:
parent
267d8cf798
commit
cabe2dc1d5
|
@ -83,7 +83,7 @@ export default class irc extends EventEmitter {
|
||||||
this.socket.write(`${data}\n`);
|
this.socket.write(`${data}\n`);
|
||||||
}
|
}
|
||||||
sendmsg(mode, recipient, msg) {
|
sendmsg(mode, recipient, msg) {
|
||||||
msg = msg.split(/\r?\n/);
|
msg = Array.isArray(msg) ? msg : msg.split(/\r?\n/);
|
||||||
if (msg.length > 6)
|
if (msg.length > 6)
|
||||||
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}", e) ));
|
msg.forEach(e => this.send( msgmodes[mode].replace("{recipient}", recipient).replace("{msg}", e) ));
|
||||||
|
@ -111,7 +111,7 @@ export default class irc extends EventEmitter {
|
||||||
message: tmp.params[1].replace(/\u0002/, ""),
|
message: tmp.params[1].replace(/\u0002/, ""),
|
||||||
time: ~~(Date.now() / 1000),
|
time: ~~(Date.now() / 1000),
|
||||||
raw: tmp,
|
raw: tmp,
|
||||||
reply: msg => this.sendmsg("normal", tmp.params[0], this.format(""+msg)),
|
reply: msg => this.sendmsg("normal", tmp.params[0], msg),
|
||||||
replyAction: msg => this.sendmsg("action", tmp.params[0], this.format(""+msg)),
|
replyAction: msg => this.sendmsg("action", tmp.params[0], this.format(""+msg)),
|
||||||
replyNotice: msg => this.sendmsg("notice", tmp.params[0], this.format(""+msg)),
|
replyNotice: msg => this.sendmsg("notice", tmp.params[0], this.format(""+msg)),
|
||||||
self: this.server,
|
self: this.server,
|
||||||
|
@ -170,6 +170,6 @@ export default class irc extends EventEmitter {
|
||||||
.replace(/\[b\](.*?)\[\/b\]/g, "\x02$1\x02") // bold
|
.replace(/\[b\](.*?)\[\/b\]/g, "\x02$1\x02") // bold
|
||||||
.replace(/\[i\](.*?)\[\/i\]/g, "\x1D$1\x1D") // italic
|
.replace(/\[i\](.*?)\[\/i\]/g, "\x1D$1\x1D") // italic
|
||||||
.replace(/\[color=(.*?)](.*?)\[\/color\]/g, replaceColor) // colors
|
.replace(/\[color=(.*?)](.*?)\[\/color\]/g, replaceColor) // colors
|
||||||
;
|
;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user