From 62ef2b87cf86d77c40d573099ba674d97a4a2b4e Mon Sep 17 00:00:00 2001 From: Aster Fialla Date: Sat, 14 Feb 2026 14:31:28 -0500 Subject: [PATCH] smoothed out username in webhook helper. made WIP method for preventing same name collapse --- helpers/webhookHelper.js | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/helpers/webhookHelper.js b/helpers/webhookHelper.js index 7946e04..91ec05a 100644 --- a/helpers/webhookHelper.js +++ b/helpers/webhookHelper.js @@ -51,14 +51,15 @@ async function getWebhook(client, channel) { * @param {Message} message - The message to be deleted. * @param {string} channelId - The channel id to send the webhook message in. * @param {string} text - The text to send via the webhook. - * @param {Object} member - A member object from the database. + * @param {model} member - A member object from the database. * @throws {Error} When there's no message to send. */ async function replaceMessage(client, message, channelId, text, member) { if (text.length > 0) { const channel = client.channels.get(channelId); const webhook = await getOrCreateWebhook(client, channel); - await webhook.send({content: text, username: member.displayname ?? member.name, avatar_url: member.propic}); + const username = member.displayname ?? member.name; + await webhook.send({content: text, username: username, avatar_url: member.propic}); await message.delete(); } else { @@ -66,6 +67,19 @@ async function replaceMessage(client, message, channelId, text, member) { } } +/** + * Fluxer collapses same-name messages, so if two would be sent by different users, break them up with a tiny space. + * @param {string} channelId - The channel id to send the webhook message in. + * @param {string} username - The text to send via the webhook. + */ + +function preventSameNameCollapse(channel, username) { + + if(bot.recent[msg.channel.id] && msg.author.id !== bot.recent[msg.channel.id][0].user_id && un === bot.recent[msg.channel.id][0].name) { + username = un.substring(0,1) + "\u200a" + un.substring(1); + } +} + /** * Replaces a proxied message with a webhook using the member information. * @param {Client} client - The fluxer.js client.