From 2251e92ac4cdd30aa6a228147b6fb32b498d25b6 Mon Sep 17 00:00:00 2001 From: Bop It Freak Date: Fri, 28 Jun 2019 02:03:01 +0000 Subject: [PATCH] Fix chat on messages without name, i.e join/leave messages. Fix client sending it's own messages to discord. havn't tested :O --- src/prbridge/index.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/prbridge/index.js b/src/prbridge/index.js index 7af0460..c7d10f3 100644 --- a/src/prbridge/index.js +++ b/src/prbridge/index.js @@ -28,9 +28,11 @@ async function messagehandle(data) { let roomName = data.roomName; let color = data.color; let id = data.id; - if (id == "[discord.gg/k44Eqha]") return; + if (id == client.socket.id) return; let c = dClient.channels.get("593943518351982603"); - if (c) c.send(`**${sanitizeName(name)}:** ${escapeDiscordMentions(data.message)}`); + let msg; + (!name && (data.message.startsWith("[i]") || data.message.startsWith("[d]"))) ? msg = `*${escapeDiscordMentions(data.message)}*` : msg = `**${sanitizeName(name)}:** ${escapeDiscordMentions(data.message)}`; + if (c) c.send(msg); } break; }