Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dev #1

Merged
merged 2 commits into from
Feb 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
53 changes: 19 additions & 34 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,40 +82,25 @@ client.on("messageCreate", async (message) => {
message.channel.send(`pong ${message.channelId}`);
}

// Command bot French
if (
message.content.startsWith(
`${languageSeter(langServerData?.lang || "en_EN").command_lang_fr}`
)
) {
message.channel.send(
`${languageSeter(langServerData?.lang || "en_EN").text_lang_fr}`
);
languageChanger(message.guildId, "fr_FR");
}

// Command bot English
if (
message.content.startsWith(
`${languageSeter(langServerData?.lang || "en_EN").command_lang_en}`
)
) {
message.channel.send(
`${languageSeter(langServerData?.lang || "en_EN").text_lang_en}`
);
languageChanger(message.guildId, "en_EN");
}

// Command bot Spanish
if (
message.content.startsWith(
`${languageSeter(langServerData?.lang || "en_EN").command_lang_es}`
)
) {
message.channel.send(
`${languageSeter(langServerData?.lang || "en_EN").text_lang_es}`
);
languageChanger(message.guildId, "es_ES");
// Change lang command
if (message.content.startsWith("!setup lang")) {
switch (message.content.toLowerCase()) {
case `${languageSeter("command").command_lang_fr}`: // Command bot French
languageChanger(message.guildId, "fr_FR");
message.channel.send(`${languageSeter("command").text_lang_fr}`);
break;
case `${languageSeter("command").command_lang_en}`: // Command bot English
languageChanger(message.guildId, "en_EN");
message.channel.send(`${languageSeter("command").text_lang_en}`);
break;
case `${languageSeter("command").command_lang_es}`: // Command bot Spanish
languageChanger(message.guildId, "es_ES");
message.channel.send(`${languageSeter("command").text_lang_es}`);
break;
default:
languageChanger(message.guildId, "en_EN");
message.channel.send(`${languageSeter("command").text_lang_error}`);
}
}

// Deleted invalid url or invalid command
Expand Down
28 changes: 10 additions & 18 deletions lang/langs.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,16 @@
// command = input command on discord

const lang = {
command: {
text_lang_fr: "Votre bot est maintenant en français",
text_lang_en: "Your bot is now in English",
text_lang_es: "Tu bot está ahora en español",
text_lang_error:
"Your language is not yet implemented we put you in English for the moment",
command_lang_fr: "!setup lang fr",
command_lang_en: "!setup lang en",
command_lang_es: "!setup lang es",
},
fr_FR: {
url1: "https://steamcommunity.com/id/",
url2: "https://steamcommunity.com/profiles/",
Expand All @@ -17,12 +27,6 @@ const lang = {
text_output: "Ce channel est le nouveau channel de sortie",
error_command: "Votre message n'est pas un URL ou une commande valide",
response_ban: "Valve à fais son travail une pute a été trouvée",
text_lang_fr: "Votre bot est maintenant en français",
text_lang_en: "Your bot is now in English",
text_lang_es: "Tu bot está ahora en español",
command_lang_fr: "!setup lang fr",
command_lang_en: "!setup lang en",
command_lang_es: "!setup lang es",
},
en_EN: {
url1: "https://steamcommunity.com/id/",
Expand All @@ -36,12 +40,6 @@ const lang = {
text_output: "This channel is the new output channel",
error_command: "Your message is not a valid URL or command",
response_ban: "Valve has done its job a slut has been found",
text_lang_fr: "Votre bot est maintenant en français",
text_lang_en: "Your bot is now in English",
text_lang_es: "Tu bot está ahora en español",
command_lang_fr: "!setup lang fr",
command_lang_en: "!setup lang en",
command_lang_es: "!setup lang es",
},
es_ES: {
url1: "https://steamcommunity.com/id/",
Expand All @@ -55,12 +53,6 @@ const lang = {
text_output: "Este canal es el nuevo canal de salida",
error_command: "Su mensaje no es una URL u comando válida",
response_ban: "Valve ha hecho su trabajo una puta ha sido encontrado",
text_lang_fr: "Votre bot est maintenant en français",
text_lang_en: "Your bot is now in English",
text_lang_es: "Tu bot está ahora en español",
command_lang_fr: "!setup lang fr",
command_lang_en: "!setup lang en",
command_lang_es: "!setup lang es",
},
};

Expand Down
3 changes: 3 additions & 0 deletions modules/languageSeter.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ const languageSeter = (data) => {
case "es_ES":
return language.es_ES;
break;
case "command": // only for commands
return language.command;
break;
}
};

Expand Down