mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-08 22:23:03 -04:00
- do not translate non-rich embeds (fixes gifs, other issues)
- add placeholder for unknown languages in translate ops
This commit is contained in:
parent
3f550a4822
commit
d9c2db1510
3 changed files with 24 additions and 7 deletions
|
@ -8,6 +8,8 @@ const { editOrReply } = require('#utils/message')
|
|||
const { STATICS } = require('#utils/statics');
|
||||
const { isSupported, getCodeFromAny } = require('#utils/translate');
|
||||
|
||||
const {MessageEmbedTypes} = require("detritus-client/lib/constants");
|
||||
|
||||
// TODO(unity): interaction/context/translate.js
|
||||
async function translateMessage(context, message, to, from){
|
||||
let mappings = {};
|
||||
|
@ -24,7 +26,9 @@ async function translateMessage(context, message, to, from){
|
|||
let i = 0;
|
||||
// Message Translation supports Descriptions and Fields
|
||||
for(const e of message.embeds){
|
||||
let emb = e[1]
|
||||
let emb = e[1];
|
||||
if(e[1].type !== MessageEmbedTypes.RICH) continue;
|
||||
|
||||
if(emb.description) mappings["embeds/" + i + "/description"] = emb.description;
|
||||
if(emb.title) mappings["embeds/" + i + "/title"] = emb.title;
|
||||
if(emb.author?.name) mappings["embeds/" + i + "/author/name"] = emb.author.name;
|
||||
|
@ -63,6 +67,8 @@ async function translateMessage(context, message, to, from){
|
|||
// Message Translation supports Descriptions and Fields
|
||||
for(const e of message.embeds){
|
||||
let emb = e[1]
|
||||
|
||||
if(e[1].type !== MessageEmbedTypes.RICH) continue;
|
||||
let newEmbed = {
|
||||
fields: []
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue