Skip to content
This repository has been archived by the owner on Dec 1, 2023. It is now read-only.

Commit

Permalink
Added some language strings for multi language support
Browse files Browse the repository at this point in the history
  • Loading branch information
Serena1432 committed Jun 26, 2021
1 parent 33b5121 commit ddfa015
Show file tree
Hide file tree
Showing 74 changed files with 375 additions and 293 deletions.
64 changes: 32 additions & 32 deletions commands/account.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,15 @@ module.exports.run = async (client, message, args, language) => {
var dateString = jd.getDate() + "/" + (jd.getMonth() + 1) + "/" + jd.getFullYear() + "; " + jd.getHours() + ":" + jd.getMinutes() + ":" + jd.getSeconds() + " (GMT +0)";
var gjd = guildMember.joinedAt;
var admin = "No";
if (guildMember.permissions.has("ADMINISTRATOR")) admin = "Yes";
if (guildMember.permissions.has("ADMINISTRATOR")) admin = language.yes;
var kickMem = "No";
if (guildMember.permissions.has("KICK_MEMBERS")) kickMem = "Yes";
if (guildMember.permissions.has("KICK_MEMBERS")) kickMem = language.yes;
var banMem = "No";
if (guildMember.permissions.has("BAN_MEMBERS")) banMem = "Yes";
if (guildMember.permissions.has("BAN_MEMBERS")) banMem = language.yes;
var roleManager = "No";
if (guildMember.permissions.has("MANAGE_ROLES")) roleManager = "Yes";
if (guildMember.permissions.has("MANAGE_ROLES")) roleManager = language.yes;
var channelManager = "No";
if (guildMember.permissions.has("MANAGE_CHANNELS")) channelManager = "Yes";
if (guildMember.permissions.has("MANAGE_CHANNELS")) channelManager = language.yes;
var joinDateString = gjd.getDate() + "/" + (gjd.getMonth() + 1) + "/" + gjd.getFullYear() + "; " + gjd.getHours() + ":" + gjd.getMinutes() + ":" + gjd.getSeconds() + " (GMT +0)";
const infoMessage = {
color: Math.floor(Math.random() * 16777214) + 1,
Expand All @@ -48,48 +48,48 @@ module.exports.run = async (client, message, args, language) => {
})
},
fields: [{
name: "Display Name:",
name: language.displayName,
value: "<@" + member.id + ">",
inline: true
},
{
name: "Member ID:",
name: language.memberID,
value: member.id,
inline: true
},
{
name: "Avatar URL:",
value: "[Download](" + member.avatarURL({
name: language.avatarURL,
value: "[" + language.download + "](" + member.avatarURL({
format: "png",
dynamic: true,
size: 2048
}) + ")",
inline: true
},
{
name: "Account created in:",
name: language.accountCreatedIn,
value: dateString,
inline: false
},
{
name: "Joined this server in:",
name: language.joinedServerIn,
value: joinDateString,
inline: false
},
{
name: "Number of roles:",
name: language.numberOfRoles,
value: guildMember.roles.cache.filter(
role => role.name !== ""
).size - 1,
inline: true
},
{
name: "Highest role",
name: language.highestRole,
value: guildMember.roles.highest.toString(),
inline: true
},
{
name: "Current Display Color:",
name: language.currentDisplayColor,
value: guildMember.displayHexColor,
inline: false
},
Expand All @@ -99,27 +99,27 @@ module.exports.run = async (client, message, args, language) => {
inline: false
},
{
name: "Is an administrator?",
name: language.isAdmin,
value: admin,
inline: true
},
{
name: "Can kick members?",
name: language.canKickMem,
value: kickMem,
inline: true
},
{
name: "Can ban members?",
name: language.canBanMem,
value: banMem,
inline: true
},
{
name: "Can manage roles?",
name: language.canManageRoles,
value: roleManager,
inline: true
},
{
name: "Can manage channels?",
name: language.canManageChannel,
value: channelManager,
inline: true
},
Expand Down Expand Up @@ -152,31 +152,31 @@ module.exports.run = async (client, message, args, language) => {
})
},
fields: [{
name: "Display Name:",
name: language.displayName,
value: "<@" + member.id + ">",
inline: true
},
{
name: "Member ID:",
name: language.memberID,
value: member.id,
inline: true
},
{
name: "Avatar URL:",
value: "[Download](" + member.avatarURL({
name: language.avatarURL,
value: "[" + language.download + "](" + member.avatarURL({
format: "png",
dynamic: true,
size: 2048
}) + ")",
inline: true
},
{
name: "Account created in:",
name: language.accountCreatedIn,
value: dateString,
inline: false
},
{
name: "Some information cannot be displayed because this user don't join this server as well.",
name: language.userDontJoinGuild,
value: "\u200b",
inline: false
},
Expand Down Expand Up @@ -210,31 +210,31 @@ module.exports.run = async (client, message, args, language) => {
})
},
fields: [{
name: "Display Name:",
name: language.displayName,
value: "<@" + member.id + ">",
inline: true
},
{
name: "Member ID:",
name: language.memberID,
value: member.id,
inline: true
},
{
name: "Avatar URL:",
value: "[Download](" + member.avatarURL({
name: language.avatarURL,
value: "[" + language.download + "](" + member.avatarURL({
format: "png",
dynamic: true,
size: 2048
}) + ")",
inline: true
},
{
name: "Account created in:",
name: language.accountCreatedIn,
value: dateString,
inline: false
},
{
name: "Some information cannot be displayed because you're using this command on a Direct Messages channel.",
name: language.userInfoOnDM,
value: "\u200b",
inline: false
},
Expand All @@ -253,7 +253,7 @@ module.exports.run = async (client, message, args, language) => {
});
}
} else {
message.reply("This user isn't exist!");
message.reply(language.userNotExist);
}
}

Expand Down
8 changes: 4 additions & 4 deletions commands/addrole.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ function random(min, max) {
}

module.exports.run = async (client, message, args, language) => {
if (!message.member.hasPermission("MANAGE_GUILD") && message.author.id != client.config.ownerId[0]) return message.reply("You need the Manage Guild permission to do this!");
if (!message.guild.member(client.user).hasPermission("MANAGE_ROLES")) return message.reply("I don't have the Manage Roles permission! Please contact the server admin!");
if (!message.member.hasPermission("MANAGE_GUILD") && message.author.id != client.config.ownerId[0]) return message.reply(language.needManageGuildPermission);
if (!message.guild.member(client.user).hasPermission("MANAGE_ROLES")) return message.reply(language.missingManageRolesPermission);
if (!client.addRole[message.author.id]) {
request(process.env.php_server_url + "/EconomyManager.php?type=get&token=" + process.env.php_server_token, function(error, response, body) {
if (!error && response.statusCode == 200 && !body.includes("Connection failed")) {
Expand All @@ -18,7 +18,7 @@ module.exports.run = async (client, message, args, language) => {
client.addRole[message.author.id] = {
channel: message.channel.id
};
message.channel.send("You are going to add a role to your server's shop.\nWhat role you're trying to add? Please mention it or send its ID to this channel.\nType `cancel` anytime to cancel the role-adding request.");
message.channel.send(language.beginServerRoleAdd);
}
catch (err) {
console.error(err);
Expand All @@ -28,7 +28,7 @@ module.exports.run = async (client, message, args, language) => {
else return message.reply(language.serverConnectError);
});
}
else return message.reply("Please complete your previous role-adding request!");
else return message.reply(language.completePreviousServerRole);
}

module.exports.config = {
Expand Down
8 changes: 4 additions & 4 deletions commands/arrest.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports.run = async (client, message, args, language) => {
});
if (message.mentions.users.size) {
if (message.mentions.users.first().id != message.author.id) {
var creatingMsg = await message.channel.send("Creating images, please wait...");
var creatingMsg = await message.channel.send(language.creatingImage);
const canvas = Canvas.createCanvas(600, 400);
const ctx = canvas.getContext('2d');

Expand All @@ -36,18 +36,18 @@ module.exports.run = async (client, message, args, language) => {
size: 256
}));
ctx.drawImage(p2avatar, 450, 0, 140, 140);
message.channel.send(message.mentions.users.first().toString() + ", you have been caught by " + message.author.toString() + "!", {
message.channel.send(message.mentions.users.first().toString() + language.haveBeenCaught + message.author.toString() + "!", {
files: [{
attachment: canvas.toBuffer(),
name: message.author.username + '_arrests_' + message.mentions.users.first().username + '.png'
}]
});
creatingMsg.delete();
} else {
message.reply("You arrested yourself, but... why??");
message.reply(language.arrestedYourself);
}
} else {
message.reply("You must mention an user!");
message.reply(language.pleaseMentionUser);
}
}

Expand Down
4 changes: 2 additions & 2 deletions commands/baka.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module.exports.run = async (client, message, args, language) => {
const image = {
color: Math.floor(Math.random() * 16777214) + 1,
author: {
name: message.mentions.users.first().username + ' is an idiot! Baka!\n' + text,
name: message.mentions.users.first().username + language.baka + '\n' + text,
icon_url: message.author.avatarURL({
format: "png",
dynamic: true,
Expand All @@ -50,7 +50,7 @@ module.exports.run = async (client, message, args, language) => {
}
});
} else {
message.reply("You must mention an user!");
message.reply(language.pleaseMentionUser);
}
}

Expand Down
16 changes: 8 additions & 8 deletions commands/balance.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ const {encrypt, decrypt} = require("../utils/crypto.js");
function bal(client, message, args, language, user) {
message.channel.send(new Discord.MessageEmbed()
.setColor(Math.floor(Math.random() * 16777215))
.setAuthor(user.username + "'s balance", user.avatarURL({size:128}))
.setAuthor(language.balance.replace("$username", user.username), user.avatarURL({size:128}))
.addFields([
{name: client.config.currency + ":", value: parseInt(decrypt(client.economyManager[user.id].coins)).toLocaleString()},
{name: "💬 Message Points:", value: (client.economyManager[user.id].messagePoints) ? parseInt(decrypt(client.economyManager[user.id].messagePoints)).toLocaleString() : "0"}
{name: "💬 " + language.messagePoints + ":", value: (client.economyManager[user.id].messagePoints) ? parseInt(decrypt(client.economyManager[user.id].messagePoints)).toLocaleString() : "0"}
])
.setTimestamp()
.setFooter(client.devUsername, client.user.avatarURL({size:128})));
Expand All @@ -18,7 +18,7 @@ function bal(client, message, args, language, user) {
module.exports.run = async (client, message, args, language) => {
if (!message.mentions.users.size) {
if (client.economyManager[message.author.id]) {
if (!client.economyManager[message.author.id].coins) return message.reply("Cannot get the coins information.");
if (!client.economyManager[message.author.id].coins) return message.reply(language.coinError);
try {
bal(client, message, args, language, message.author);
return;
Expand All @@ -34,7 +34,7 @@ module.exports.run = async (client, message, args, language) => {
try {
client.economyManager = JSON.parse(body);
if (client.economyManager[message.author.id] != undefined) {
if (!client.economyManager[message.author.id].coins) return message.reply("Cannot get the coins information.");
if (!client.economyManager[message.author.id].coins) return message.reply(language.coinError);
try {
bal(client, message, args, language, message.author);
return;
Expand All @@ -56,7 +56,7 @@ module.exports.run = async (client, message, args, language) => {
data: JSON.stringify(client.economyManager[message.author.id])
}}, function(error, response, body) {
if (!error && response.statusCode == 200 && body.includes("Success")) {
if (!client.economyManager[message.author.id].coins) return message.reply("Cannot get the coins information.");
if (!client.economyManager[message.author.id].coins) return message.reply(language.coinError);
try {
bal(client, message, args, language, message.author);
return;
Expand Down Expand Up @@ -88,7 +88,7 @@ module.exports.run = async (client, message, args, language) => {
}
else {
if (client.economyManager[message.mentions.users.first().id]) {
if (!client.economyManager[message.mentions.users.first().id].coins) return message.reply("Cannot get the coins information.");
if (!client.economyManager[message.mentions.users.first().id].coins) return message.reply(language.coinError);
try {
bal(client, message, args, language, message.mentions.users.first());
return;
Expand All @@ -104,7 +104,7 @@ module.exports.run = async (client, message, args, language) => {
try {
client.economyManager = JSON.parse(body);
if (client.economyManager[message.mentions.users.first().id] != undefined) {
if (!client.economyManager[message.mentions.users.first().id].coins) return message.reply("Cannot get the coins information.");
if (!client.economyManager[message.mentions.users.first().id].coins) return message.reply(language.coinError);
try {
bal(client, message, args, language, message.mentions.users.first());
return;
Expand All @@ -126,7 +126,7 @@ module.exports.run = async (client, message, args, language) => {
data: JSON.stringify(client.economyManager[message.mentions.users.first().id])
}}, function(error, response, body) {
if (!error && response.statusCode == 200 && body.includes("Success")) {
if (!client.economyManager[message.mentions.users.first().id].coins) return message.reply("Cannot get the coins information.");
if (!client.economyManager[message.mentions.users.first().id].coins) return message.reply(language.coinError);
try {
bal(client, message, args, language, message.mentions.users.first());
return;
Expand Down
Loading

0 comments on commit ddfa015

Please sign in to comment.