whoops had overlooked that

This commit is contained in:
jenz
2026-08-07 20:13:17 +02:00
parent 6c834ac87e
commit 3ef8b037a7
+11 -2
View File
@@ -274,8 +274,8 @@ async function checkNewMessages(channel_selected, admin_chat_bool) {
if (!author || author.bot) continue; if (!author || author.bot) continue;
const content = message.content || ""; const content = sanitizeForRcon(message.content) || "";
const username = author.username || "Unknown"; const username = sanitizeForRcon(author.username) || "Unknown";
//console.log(`[New] ${username}: ${content}`); //console.log(`[New] ${username}: ${content}`);
if (channel_selected == channel_livechat || channel_selected == channel_adminchat_ze) if (channel_selected == channel_livechat || channel_selected == channel_adminchat_ze)
@@ -304,6 +304,15 @@ async function checkNewMessages(channel_selected, admin_chat_bool) {
} }
} }
function sanitizeForRcon(str, maxLength = 200) {
if (typeof str !== 'string') return '';
return str
.replace(/[^\w\s.,!?'\-]/g, '') // keep only safe chars, strip everything else
.trim()
.slice(0, maxLength);
}
var lastProcessedMessageId_rcon_ze = null; var lastProcessedMessageId_rcon_ze = null;
async function checkNewMessages_rcon_ze() { async function checkNewMessages_rcon_ze() {
try { try {