2022-01-13 00:56:24 +05:00
|
|
|
const Command = require("../../base/Command");
|
2022-01-04 02:18:28 +05:00
|
|
|
|
|
|
|
class Setlang extends Command {
|
|
|
|
constructor(client) {
|
|
|
|
super(client, {
|
|
|
|
name: "setlang",
|
|
|
|
dirname: __dirname,
|
|
|
|
enabled: true,
|
|
|
|
guildOnly: true,
|
|
|
|
aliases: ["setl"],
|
|
|
|
memberPermissions: ["MANAGE_GUILD"],
|
|
|
|
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
|
|
nsfw: false,
|
|
|
|
ownerOnly: false,
|
|
|
|
cooldown: 1000
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
async run(message, args, data) {
|
|
|
|
const language = this.client.languages.find((l) => l.name === args[0] || l.aliases.includes(args[0]));
|
|
|
|
|
2022-02-11 12:43:52 +05:00
|
|
|
if (!args[0] || !language) return message.error("administration/setlang:MISSING_LANG", { list: this.client.languages.map((l) => `\`${l.name} (${l.aliases.slice(0, 2).join(", ")})\``).join(", ") });
|
2022-01-04 02:18:28 +05:00
|
|
|
|
|
|
|
data.guild.language = language.name;
|
|
|
|
await data.guild.save();
|
|
|
|
|
|
|
|
return message.sendT("administration/setlang:SUCCESS", {
|
|
|
|
lang: language.nativeName
|
|
|
|
});
|
|
|
|
}
|
2022-01-13 00:26:23 +05:00
|
|
|
}
|
2022-01-04 02:18:28 +05:00
|
|
|
|
|
|
|
module.exports = Setlang;
|