From c63ca62707d2908a78cbb556432c5bea1842945c Mon Sep 17 00:00:00 2001 From: Hazmi Alfarizqi Date: Tue, 20 Feb 2024 15:40:08 +0700 Subject: [PATCH] fix(GuildCreateListener): fix regex --- .../Caches/Guilds/GuildCreateListener.ts | 20 +++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/services/kanao-gateway/src/Listeners/Caches/Guilds/GuildCreateListener.ts b/services/kanao-gateway/src/Listeners/Caches/Guilds/GuildCreateListener.ts index a822d292..dd68e202 100644 --- a/services/kanao-gateway/src/Listeners/Caches/Guilds/GuildCreateListener.ts +++ b/services/kanao-gateway/src/Listeners/Caches/Guilds/GuildCreateListener.ts @@ -106,8 +106,8 @@ export class GuildCreateListener extends Listener { let ops = []; for (const role of payload.data.d.roles) { if (ops.length >= 500 || ops.length > 0) { - const SQLs = ops.map(q => q.sql.replaceAll(/\$(?\d+)/gu, (match, groups) => { - let value = q.params[Number(groups.index) - 1]; + const SQLs = ops.map(q => q.sql.replaceAll(/\$(?\d+)/gu, (match, index) => { + let value = q.params[Number(index) - 1]; // If the value is a string, wrap it in quotes if (typeof value === "string") { @@ -149,8 +149,8 @@ export class GuildCreateListener extends Listener { for (const member of payload.data.d.members) { if (member.user !== undefined) { if (ops.length >= 500 || ops.length > 0) { - const SQLs = ops.map(q => q.sql.replaceAll(/\$(?\d+)/gu, (match, groups) => { - let value = q.params[Number(groups.index) - 1]; + const SQLs = ops.map(q => q.sql.replaceAll(/\$(?\d+)/gu, (match, index) => { + let value = q.params[Number(index) - 1]; // If the value is a string, wrap it in quotes if (typeof value === "string") { @@ -198,8 +198,8 @@ export class GuildCreateListener extends Listener { for (const member of payload.data.d.members) { if (member.user !== undefined) { if (ops.length >= 500 || ops.length > 0) { - const SQLs = ops.map(q => q.sql.replaceAll(/\$(?\d+)/gu, (match, groups) => { - let value = q.params[Number(groups.index) - 1]; + const SQLs = ops.map(q => q.sql.replaceAll(/\$(?\d+)/gu, (match, index) => { + let value = q.params[Number(index) - 1]; // If the value is a string, wrap it in quotes if (typeof value === "string") { @@ -260,8 +260,8 @@ export class GuildCreateListener extends Listener { for (const channel of payload.data.d.channels) { if (ops.length >= 500 || ops.length > 0) { - const SQLs = ops.map(q => q.sql.replaceAll(/\$(?\d+)/gu, (match, groups) => { - let value = q.params[Number(groups.index) - 1]; + const SQLs = ops.map(q => q.sql.replaceAll(/\$(?\d+)/gu, (match, index) => { + let value = q.params[Number(index) - 1]; // If the value is a string, wrap it in quotes if (typeof value === "string") { @@ -308,8 +308,8 @@ export class GuildCreateListener extends Listener { if (voice.channel_id === null) continue; if (ops.length >= 500 || ops.length > 0) { - const SQLs = ops.map(q => q.sql.replaceAll(/\$(?\d+)/gu, (match, groups) => { - let value = q.params[Number(groups.index) - 1]; + const SQLs = ops.map(q => q.sql.replaceAll(/\$(?\d+)/gu, (match, index) => { + let value = q.params[Number(index) - 1]; // If the value is a string, wrap it in quotes if (typeof value === "string") {