mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 05:04:58 +05:00
Локализация permissions
This commit is contained in:
parent
e79d799b7a
commit
2b0b96729d
2 changed files with 9 additions and 5 deletions
|
@ -21,22 +21,26 @@ class Permissions extends Command {
|
|||
|
||||
async run(message) {
|
||||
const member = message.mentions.members.first() || message.member;
|
||||
let text = "```\n" + `${message.translate("general/permissions:TITLE", { user: member.user.username, channel: message.channel.name })}\n\n`;
|
||||
const mPermissions = message.channel.permissionsFor(member);
|
||||
const total = {
|
||||
denied: 0,
|
||||
allowed: 0
|
||||
};
|
||||
|
||||
let text = `${message.translate("general/permissions:TITLE", { user: member.user.username, channel: message.channel.name })}\n\n`;
|
||||
permissions.forEach((perm) => {
|
||||
if (perm === "REQUEST_TO_SPEAK") return;
|
||||
|
||||
if (!mPermissions.has(perm)) {
|
||||
text += `${perm} ❌\n`;
|
||||
text += `${message.translate(`misc:PERMISSIONS:${perm}`)} ❌\n`;
|
||||
total.denied++;
|
||||
} else {
|
||||
text += `${perm} ✅\n`;
|
||||
text += `${message.translate(`misc:PERMISSIONS:${perm}`)} ✅\n`;
|
||||
total.allowed++;
|
||||
}
|
||||
});
|
||||
text += `\n${total.allowed} ✅ | ${total.denied} ❌` + "\n```";
|
||||
text += `\n${total.allowed} ✅ | ${total.denied} ❌`;
|
||||
|
||||
message.channel.send({
|
||||
content: text
|
||||
});
|
||||
|
|
|
@ -145,7 +145,7 @@ module.exports = class {
|
|||
if (!message.channel.permissionsFor(message.member).has(perm)) neededPermissions.push(perm);
|
||||
});
|
||||
|
||||
if (neededPermissions.length > 0) return message.error("misc:MISSING_MEMBER_PERMS", { list: neededPermissions.map((p) => `\`${message.translate(`misc:PERMISSIONS:${p.toUpperCase()}`)}\``).join(", ") });
|
||||
if (neededPermissions.length > 0) return message.error("misc:MISSING_MEMBER_PERMS", { list: neededPermissions.map((p) => `\`${message.translate(`misc:PERMISSIONS:${p}`)}\``).join(", ") });
|
||||
if (!message.channel.permissionsFor(message.member).has(Permissions.FLAGS.MENTION_EVERYONE) && (message.content.includes("@everyone") || message.content.includes("@here"))) return message.error("misc:EVERYONE_MENTION");
|
||||
if (!message.channel.nsfw && cmd.conf.nsfw) return message.error("misc:NSFW_COMMAND");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue