“Mute Command Discord.js v12” Ответ

Мореть всех в Call Discord.js

client.on('message', (message) => {
    if (message.content == '/muteAll') {
        let channel = message.member.voiceChannel;
        for (let member of channel.members) {
            member[1].setMute(true)
        }
     }
});

Mute Command Discord.js v12

client.on("message", message => {
  if (message.content.startsWith(prefix + "mute")) {
    
    
    // Variables
    var muteRole = message.guild.roles.find(role => role.name.toLowerCase().includes("muted"));
    var muteChannel = message.guild.channels.find(channel => channel.name.includes("modlogs"));
    var muteUser = message.mentions.members.first();
    var muteReason = message.content.slice(prefix.length + 27);
    
    
    // Conditions for muting
    if (!message.member.hasPermission("MANAGE_MESSAGES")) return message.channel.send("You don't have the permissions"); //the member has higher perms
    if (!muteUser) return message.channel.send("You have to mention a valid member");
    if (!muteChannel) return message.channel.send("There's no channel called modlogs");
    if (!muteRole) return message.channel.send("There's no role called muted");
    if (!message.guild.member(client.user.id).hasPermission("MANAGE_ROLES")) return message.channel.send("I Don't have permissions");
    if (!muteReason) muteReason = "No reason given";
    
    // Embed for details of mute
    var muteEmbed = new Discord.RichEmbed() 
    .setTitle("Mute")
    .addField("Muted user", muteUser)
    .addField("Reason", muteReason)
    .setFooter(`Muted by ${message.author.tag}`)
    .setTimestamp();
    
    //Mute
    muteUser.addRole(muteRole);
    message.channel.send(`${muteUser} has been muted`);
    muteChannel.send(muteEmbed);
    
  }
})
Blushing Baboon

Ответы похожие на “Mute Command Discord.js v12”

Вопросы похожие на “Mute Command Discord.js v12”

Больше похожих ответов на “Mute Command Discord.js v12” по JavaScript

Смотреть популярные ответы по языку

Смотреть другие языки программирования