mirror of
https://gitlab.com/bignutty/labscore.git
synced 2025-06-08 14:13:02 -04:00
disable ctx translate if no valid language is supplied
This commit is contained in:
parent
e61a604b7c
commit
28d67297b6
1 changed files with 7 additions and 2 deletions
|
@ -30,13 +30,18 @@ module.exports = {
|
||||||
await context.triggerTyping();
|
await context.triggerTyping();
|
||||||
|
|
||||||
let content = args.text;
|
let content = args.text;
|
||||||
|
|
||||||
|
// TODO: Turn this into a reply helper
|
||||||
if(context.message.messageReference) {
|
if(context.message.messageReference) {
|
||||||
let msg = await context.message.channel.fetchMessage(context.message.messageReference.messageId);
|
let msg = await context.message.channel.fetchMessage(context.message.messageReference.messageId);
|
||||||
if(msg.content && msg.content.length) content = msg.content
|
if(msg.content && msg.content.length) content = msg.content
|
||||||
if(msg.embeds?.length) for(const e of msg.embeds) if(e[1].description?.length) { content += '\n' + e[1].description; break; }
|
if(msg.embeds?.length) for(const e of msg.embeds) if(e[1].description?.length) { content += '\n' + e[1].description; break; }
|
||||||
|
|
||||||
// Translate using direct language input
|
// Controls ctx-based translations
|
||||||
if(args.text) args.to = args.text;
|
if(args.text.length >= 1 && getCodeFromAny(args.text)) args.to = args.text;
|
||||||
|
else if(args.text.length >= 1) content = args.text;
|
||||||
|
|
||||||
|
console.log(args)
|
||||||
}
|
}
|
||||||
|
|
||||||
if(!content.length) return editOrReply(context, createEmbed("warning", context, "No text supplied."))
|
if(!content.length) return editOrReply(context, createEmbed("warning", context, "No text supplied."))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue