diff --git a/cmds/utility/translate.js b/cmds/utility/translate.js index 1f5fde8..4132e45 100644 --- a/cmds/utility/translate.js +++ b/cmds/utility/translate.js @@ -50,7 +50,8 @@ module.exports = class translate extends commando.Command { `\`ru\` Russian\n` + `\`es\` Spanish\n` + `\`tr\` Turkish\n` + - `\`vi\` Vietnamese` + `\`vi\` Vietnamese\n\n` + + `\`--h\` for help` }); } /** @@ -87,15 +88,15 @@ module.exports = class translate extends commando.Command { if (tmes) trans = tmes.cleanContent || tmes.content; if (ic) tar = TP; else tar = "en"; if (ic) { - if (!tmes) trans = msg.cleanContent.slice((msg.guild.commandPrefix + msg.alias + TP).length).trim() || msg.channel.messages.cache.get(msg.channel.lastMessagesID[1])?.cleanContent; + if (!tmes) trans = msg.cleanContent.slice((msg.guild.commandPrefix + msg.alias + TP).length + 2).trim() || msg.channel.messages.cache.get(msg.previousMessageID)?.cleanContent; } else { - if (!tmes) if (!arg || arg.length === 0) trans = msg.channel.messages.cache.get(msg.channel.lastMessagesID[1])?.cleanContent; else trans = msg.cleanContent.slice((msg.guild.commandPrefix + msg.alias).length + 1).trim(); + if (!tmes) trans = msg.cleanContent.slice((msg.guild.commandPrefix + msg.alias).length + 1).trim() || msg.channel.messages.cache.get(msg.previousMessageID)?.cleanContent; }; if (!trans || trans.length === 0) { return trySend(msg.client, msg, "Nothing to translate. `--h` for help <:nekohmLife:846371737644957786>"); } const res = await axios.post("https://translate.mentality.rip/translate", { - q: trans, + q: trans.replace(/\./g, ","), source: "auto", target: tar }).then(r => { diff --git a/resources/structures.js b/resources/structures.js index 80172ea..b5ad55f 100644 --- a/resources/structures.js +++ b/resources/structures.js @@ -187,4 +187,13 @@ Structures.extend("DMChannel", e => { return this.lastMessagesID.push(this.lastMessageID); }; } +}); + +Structures.extend("Message", e => { + return class Message extends e { + constructor(client, data, channel) { + super(client, data, channel); + this.previousMessageID = channel.lastMessageID; + }; + } }); \ No newline at end of file