<:epicLife:853254812606660619>

This commit is contained in:
Neko Life 2021-06-30 12:31:15 +09:00
parent e2a0e4d332
commit 44e099f530
2 changed files with 14 additions and 4 deletions

View file

@ -50,7 +50,8 @@ module.exports = class translate extends commando.Command {
`\`ru\` Russian\n` + `\`ru\` Russian\n` +
`\`es\` Spanish\n` + `\`es\` Spanish\n` +
`\`tr\` Turkish\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 (tmes) trans = tmes.cleanContent || tmes.content;
if (ic) tar = TP; else tar = "en"; if (ic) tar = TP; else tar = "en";
if (ic) { 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 { } 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) { if (!trans || trans.length === 0) {
return trySend(msg.client, msg, "Nothing to translate. `--h` for help <:nekohmLife:846371737644957786>"); return trySend(msg.client, msg, "Nothing to translate. `--h` for help <:nekohmLife:846371737644957786>");
} }
const res = await axios.post("https://translate.mentality.rip/translate", { const res = await axios.post("https://translate.mentality.rip/translate", {
q: trans, q: trans.replace(/\./g, ","),
source: "auto", source: "auto",
target: tar target: tar
}).then(r => { }).then(r => {

View file

@ -187,4 +187,13 @@ Structures.extend("DMChannel", e => {
return this.lastMessagesID.push(this.lastMessageID); 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;
};
}
}); });