diff --git a/commands/interaction/context/translate.js b/commands/interaction/context/translate.js index c9c7f14..49932a0 100644 --- a/commands/interaction/context/translate.js +++ b/commands/interaction/context/translate.js @@ -3,7 +3,7 @@ const { TRANSLATE_DISPLAY_MAPPINGS, TRANSLATE_LANGUAGES, TRANSLATE_LANGUAGE_MAPP const { createEmbed } = require('#utils/embed'); const { acknowledge } = require('#utils/interactions'); -const { icon } = require('#utils/markdown'); +const { icon, stringwrap } = require('#utils/markdown'); const { editOrReply } = require('#utils/message'); const { ApplicationCommandTypes, InteractionCallbackTypes, InteractionContextTypes, ApplicationIntegrationTypes } = require("detritus-client/lib/constants"); @@ -53,7 +53,7 @@ async function translateMessage(context, message, to, from){ let result = {}; // This relies on mappings.content to handle the special case - if(mappings.content) result.content = tr["content"]; + if(mappings.content) result.content = stringwrap(tr["content"], 1900); if(message.embeds) { let i = 0; @@ -71,13 +71,13 @@ async function translateMessage(context, message, to, from){ if(emb.image) newEmbed.image = emb.image; if(emb.url) newEmbed.url = emb.url; - if(emb.description) newEmbed.description = tr["embeds/" + i + "/description"]; + if(emb.description) newEmbed.description = stringwrap(tr["embeds/" + i + "/description"], 4096); if(emb.author) newEmbed.author = Object.assign({}, emb.author); - if(emb.author?.name) newEmbed.author.name = tr["embeds/" + i + "/author/name"]; + if(emb.author?.name) newEmbed.author.name = stringwrap(tr["embeds/" + i + "/author/name"], 256); if(emb.footer) newEmbed.footer = Object.assign({}, emb.footer); - if(emb.footer?.text) newEmbed.footer.text = tr["embeds/" + i + "/footer/text"]; + if(emb.footer?.text) newEmbed.footer.text = stringwrap(tr["embeds/" + i + "/footer/text"], 2048); if(emb.fields){ let fi = 0; @@ -86,8 +86,8 @@ async function translateMessage(context, message, to, from){ inline: f[1].inline } - newEmbed.fields[fi].name = tr["embeds/" + i + "/fields/" + fi + "/name"] - newEmbed.fields[fi].value = tr["embeds/" + i + "/fields/" + fi + "/value"] + newEmbed.fields[fi].name = stringwrap(tr["embeds/" + i + "/fields/" + fi + "/name"], 256); + newEmbed.fields[fi].value = stringwrap(tr["embeds/" + i + "/fields/" + fi + "/value"], 1024) fi++; } }