mirror of
https://github.com/danbulant/Shasha
synced 2026-07-06 19:41:04 +00:00
<:epicLife:853254812606660619>
This commit is contained in:
parent
e2a0e4d332
commit
44e099f530
2 changed files with 14 additions and 4 deletions
|
|
@ -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 => {
|
||||||
|
|
|
||||||
|
|
@ -188,3 +188,12 @@ Structures.extend("DMChannel", e => {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Structures.extend("Message", e => {
|
||||||
|
return class Message extends e {
|
||||||
|
constructor(client, data, channel) {
|
||||||
|
super(client, data, channel);
|
||||||
|
this.previousMessageID = channel.lastMessageID;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
});
|
||||||
Loading…
Reference in a new issue