Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = module.require("discord.js");
- const ms = require("ms");
- const commando = require('discord.js-commando');
- const discord = require('discord.js');
- const bot = new commando.Client();
- class WarnCommand extends commando.Command
- {
- constructor(client)
- {
- super(client,{
- name: 'mute',
- group: 'admin',
- memberName: 'mute',
- description: 'Mutes the specified user usage !mute @user time in minutes \(Admin+)'
- });
- }
- async run(message, args)
- {
- //!mute @user 1s/m/h/d
- if(!message.member.hasPermission("KICK_MEMBERS")) return message.reply("You cant do this command!");
- let wUser = message.guild.member(message.mentions.users.first()) || message.guild.members.get(args[0])
- if(!wUser) return message.reply("Couldn't find them");
- if(wUser.hasPermission("KICK_MEMBERS")) return message.reply("You cannot warn this person!");
- let words = args.split(' ');
- let reason = words.slice(1).join(' ');
- let warnEmbed = new Discord.RichEmbed()
- .setDescription("Mute")
- .setAuthor(message.author.username)
- .setColor("#fc6400")
- .addField("Muted User", `<@${wUser.id}>`)
- .addField("Muted In", message.channel)
- .addField("Time", reason);
- let warnchannel = message.guild.channels.find(`name`, "log");
- if(!warnchannel) return message.reply("Couldn't find channel");
- warnchannel.send(warnEmbed);
- let muterole = message.guild.roles.find(`name`, "muted");
- if(!muterole) return message.reply("You should create that role.");
- if(reason === isNaN) return message.channel.send("Please specify a number and time");
- wUser.addRole(muterole.id);
- message.channel.send(`<@${wUser.id}> has been temporarily muted`);
- setTimeout(function(){
- message.reply(`<@${wUser.id}> has been unmuted.`);
- wUser.removeRole(muterole.id);
- }, ms(reason))
- }
- }
- module.exports = WarnCommand;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement