From 849ae63144b40e65b138a9d31995d4fbcd46ce6f Mon Sep 17 00:00:00 2001 From: Lamp Date: Mon, 3 Jan 2022 21:06:31 -0800 Subject: [PATCH] fix 3 --- mppbridger.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/mppbridger.js b/mppbridger.js index 6fa3709..f0e4f71 100644 --- a/mppbridger.js +++ b/mppbridger.js @@ -6,9 +6,9 @@ global.createMPPbridge = async function createMPPbridge({room, channel, uri}) { var webhook = webhooks.filter(w => w.token).first() || await channel.createWebhook("sdfadffg"); //todo figure out new way to buffer - function dSend(msg, options) { - if (arguments.length == 1) options = msg; - + function dSend(msg, options = {}) { + if (msg) options.content = msg; + if (options.content?.length > 2000) { options.attachments ||= []; options.attachments.push(new Discord.MessageAttachment(Buffer.from(options.content), "message.txt")); @@ -150,7 +150,7 @@ global.createMPPbridge = async function createMPPbridge({room, channel, uri}) { // on notifications gClient.on('notification', async msg => { // show notification - dSend({embeds:[{ + dSend(undefined, {embeds:[{ title: msg.title, description: msg.text || msg.html }]});