mirror of
https://github.com/danbulant/Shasha
synced 2026-07-06 11:30:48 +00:00
fix: translate
This commit is contained in:
parent
bd87364422
commit
6475584fab
1 changed files with 4 additions and 2 deletions
|
|
@ -86,17 +86,19 @@ module.exports = class translate extends commando.Command {
|
||||||
};
|
};
|
||||||
arg = arg.replace(REG, "").trim();
|
arg = arg.replace(REG, "").trim();
|
||||||
const TP = arg.split(/ +/, 1)?.[0].trim();
|
const TP = arg.split(/ +/, 1)?.[0].trim();
|
||||||
|
const CLEANCONT = msg.cleanContent.slice(msg.guild.commandPrefix.length);
|
||||||
let trans, tar, ic = SPLG.includes(TP);
|
let trans, tar, ic = SPLG.includes(TP);
|
||||||
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 + 2).trim() || msg.channel.messages.cache.get(msg.previousMessageID)?.cleanContent;
|
if (!tmes) trans = CLEANCONT.slice(((CLEANCONT.match(/^[^\s\n]+(\s|\n|$)+/)?.[0] || "") + TP).length).trim() || msg.channel.messages.cache.get(msg.previousMessageID)?.cleanContent;
|
||||||
} else {
|
} else {
|
||||||
if (!tmes) trans = msg.cleanContent.slice((msg.guild.commandPrefix + msg.alias).length + 1).trim() || msg.channel.messages.cache.get(msg.previousMessageID)?.cleanContent;
|
if (!tmes) trans = CLEANCONT.slice((CLEANCONT.match(/^[^\s\n]+(\s|\n|$)+/)?.[0] || "").length).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>");
|
||||||
}
|
}
|
||||||
|
console.log(trans);
|
||||||
ex++;
|
ex++;
|
||||||
if (ex > 1) rl += 6;
|
if (ex > 1) rl += 6;
|
||||||
const t = rl * 100;
|
const t = rl * 100;
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue