Compare commits

...

3 Commits

Author SHA1 Message Date
Hri7566 8eef0cd925 Remove debug logs 2024-09-02 16:38:12 -04:00
Hri7566 ced2f1a2f9 Add helper functions to ChannelList 2024-09-02 16:38:00 -04:00
Hri7566 285776602d Fix readline 2024-09-02 16:37:43 -04:00
3 changed files with 27 additions and 8 deletions

View File

@ -527,7 +527,7 @@ export class Channel extends EventEmitter {
if (chid == config.fullChannel) {
const banTime = this.getBanTime(socket.getUserID());
this.logger.debug("Ban time:", banTime);
//this.logger.debug("Ban time:", banTime);
if (banTime) {
const minutes = Math.floor((banTime.endTime - banTime.startTime) / 1000 / 60);
@ -827,26 +827,34 @@ export class Channel extends EventEmitter {
* @param socket Socket that is sending notes
* @returns undefined
*/
public playNotes(msg: ServerEvents["n"], socket: Socket) {
public playNotes(msg: ServerEvents["n"], socket?: Socket) {
if (this.isDestroyed()) return;
let pianoPartID = usersConfig.adminParticipant.id;
if (socket) {
const part = socket.getParticipant();
if (!part) return;
pianoPartID = part.id;
}
let clientMsg: ClientEvents["n"] = {
m: "n",
n: msg.n,
t: msg.t,
p: part.id
p: pianoPartID
};
let sentSocketIDs = new Array<string>();
for (const p of this.ppl) {
socketLoop: for (const sock of socketsBySocketID.values()) {
this.logger.debug(`Socket ${sock.getUUID()}`);
if (sock.isDestroyed()) continue socketLoop;
if (!sock.socketID) continue socketLoop;
if (socket) {
if (sock.getUUID() == socket.getUUID()) continue socketLoop;
}
if (sock.getParticipantID() != p.id) continue socketLoop;
//if (socket.getParticipantID() == part.id) continue socketLoop;
if (sentSocketIDs.includes(sock.socketID)) continue socketLoop;

View File

@ -48,6 +48,14 @@ export class ChannelList {
return this.list;
}
public static getChannel(_id: string) {
return this.list.find(ch => ch.getID() === _id);
}
public static getChannelFuzzy(text: string) {
return this.list.find(ch => ch.getID().toLowerCase() == text.toLowerCase());
}
public static getPublicList() {
return this.list.filter(ch => ch.getSetting("visible") == true);
}

View File

@ -111,9 +111,12 @@ Command.addCommand(
return bytes;
}
const argcat = msg.args.slice(1).join(" ");
if (msg.args.length > 1) {
try {
const output = eval(msg.args[1]);
const output = eval(argcat);
return output;
} catch (err) {
return err;