Skip to content

Commit

Permalink
。 Added discrete character to jump back to the original message in re…
Browse files Browse the repository at this point in the history
…plicas
  • Loading branch information
-ˏˋ Maple ˊˎ committed Dec 18, 2023
1 parent 0ceb7ed commit cd0ef30
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/bot/events/messageCreate.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@ module.exports = {
}

async function replicaHandler(message, replicaChannel) {
let translated = {text: " "}
let translated = {text: ""}
if (message.content) {
// translate the message
translated = await message.client.translate(message.content, replicaChannel.target_language_code);
translated.to = undefined
}

// if the source and target channels are equals, check if the message is the same as the original or if it's coming from the same language
if (replicaChannel.source_channel_id === replicaChannel.target_channel_id && (translated.text === message.content || translated.from === replicaChannel.target_language_code)) return;
else translated.text += `[。](<${message.url}>)`; //adds a discrete character at the end of each messages referencing the original message

// if possible use webhooks, otherwise use the bot
// if the channel is a thread the webhook needs to be created in the parent channel
Expand Down

0 comments on commit cd0ef30

Please sign in to comment.