mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-22 01:57:54 +02:00
Move Translator Functions Outside of the Command Runner
This commit is contained in:
+20
-19
@@ -1,23 +1,6 @@
|
|||||||
const commando = require('discord.js-commando');
|
const commando = require('discord.js-commando');
|
||||||
|
|
||||||
module.exports = class TemmieCommand extends commando.Command {
|
const dictionary = {
|
||||||
constructor(Client){
|
|
||||||
super(Client, {
|
|
||||||
name: 'temmie',
|
|
||||||
group: 'textedit',
|
|
||||||
memberName: 'temmie',
|
|
||||||
description: "Translate text to Temmie speak. (;temmie I am Temmie)",
|
|
||||||
examples: [";temmie I am Temmie."]
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
async run(message) {
|
|
||||||
if(message.channel.type !== 'dm') {
|
|
||||||
if(!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
|
||||||
}
|
|
||||||
console.log("[Command] " + message.content);
|
|
||||||
|
|
||||||
let dictionary = {
|
|
||||||
"i": "tem",
|
"i": "tem",
|
||||||
"hi": "hoi",
|
"hi": "hoi",
|
||||||
"that": "dat",
|
"that": "dat",
|
||||||
@@ -167,7 +150,8 @@ module.exports = class TemmieCommand extends commando.Command {
|
|||||||
let character = text[i];
|
let character = text[i];
|
||||||
if (isLetter(character)) {
|
if (isLetter(character)) {
|
||||||
word += character;
|
word += character;
|
||||||
} else {
|
}
|
||||||
|
else {
|
||||||
if (word != "") {
|
if (word != "") {
|
||||||
let wordTranslate = translateWord(word);
|
let wordTranslate = translateWord(word);
|
||||||
translatedText += wordTranslate;
|
translatedText += wordTranslate;
|
||||||
@@ -182,6 +166,23 @@ module.exports = class TemmieCommand extends commando.Command {
|
|||||||
return translatedText;
|
return translatedText;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
module.exports = class TemmieCommand extends commando.Command {
|
||||||
|
constructor(Client) {
|
||||||
|
super(Client, {
|
||||||
|
name: 'temmie',
|
||||||
|
group: 'textedit',
|
||||||
|
memberName: 'temmie',
|
||||||
|
description: "Translate text to Temmie speak. (;temmie I am Temmie)",
|
||||||
|
examples: [";temmie I am Temmie."]
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
async run(message) {
|
||||||
|
if (message.channel.type !== 'dm') {
|
||||||
|
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
||||||
|
}
|
||||||
|
console.log("[Command] " + message.content);
|
||||||
let thingToTranslate = message.content.split(" ").slice(1).join(" ");
|
let thingToTranslate = message.content.split(" ").slice(1).join(" ");
|
||||||
let temspeak = translator(thingToTranslate);
|
let temspeak = translator(thingToTranslate);
|
||||||
let noing = temspeak.split("ing").join("in");
|
let noing = temspeak.split("ing").join("in");
|
||||||
|
|||||||
Reference in New Issue
Block a user