SHARE
TWEET

Untitled

a guest Nov 12th, 2019 66 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require("discord.js");
  2. const ms = require("ms");
  3.  
  4. module.exports.run = async (bot, message, args) => {
  5.  
  6.   message.delete();
  7.  
  8.   if (!message.member.hasPermission("MANAGE_MESSAGES"))
  9.     return message.channel.send({
  10.       embed: {
  11.         color: Math.floor(Math.random() * 16777214) + 1,
  12.         description: `${message.author} ❗ You don't have permissions.`
  13.       }
  14.     });
  15.  
  16.   let mutee = message.mentions.members.first();
  17.   if (!mutee)
  18.     return message.channel.send(`Please Choose a specific user`);
  19.  
  20.  
  21.   if (!message.member.hasPermission("MANAGE_MESSAGES, ADMINISTRATOR"))
  22.     return message.channel.send(`You can't prison this member.`);
  23.  
  24.  
  25.   let notime = args[1];
  26.   if (!notime)
  27.     return message.channel.send(`Please set time for the prison.`);
  28.  
  29.   let noreason = args.slice(1).join(" ");
  30.   if (!noreason)
  31.     return message.channel.send(`Please add a reason to the prison.`);
  32.  
  33.   let toprison =
  34.     message.guild.members.find(m => m.toString() == args[0]) ||
  35.     message.guild.members.get(args[0]);
  36.   if (!toprison) return message.channel.send(mutee);
  37.   if (toprison.hasPermissions("MANAGE_ROLES"))
  38.     return message.channel.send(`You don't have permissions.`);
  39.  
  40.   let prisonrole = message.guild.roles.find(role => role.name == "Prison");
  41.   if (!prisonrole) {
  42.     try {
  43.       prisonrole = await message.guild.createRole({
  44.         name: "Prison",
  45.         color: "#000000",
  46.         permissions: []
  47.       });
  48.       message.guild.channel.forEach(async (channel, id) => {
  49.         await channel.overwritePermissions(prisonrole, {
  50.           SEND_MESSAGES: true,
  51.           ADD_REACTIONS: false
  52.         });
  53.       });
  54.     } catch (e) {
  55.       console.log(e.stack);
  56.     }
  57.   }
  58.  
  59.   let prisontime = args[1];
  60.   if (!prisontime) return message.channel.send(notime);
  61.   if (isNaN(ms(prisontime))) return message.channel.send(notime);
  62.   let reason = args.slice(2).join(" ");
  63.   if (!reason) return message.channel.send(noreason);
  64.  
  65.   let prisonembed = new Discord.RichEmbed()
  66.     .setAuthor(toprison.user.username, toprison.user.displayAvatarURL)
  67.     .setColor("DARK_GOLD")
  68.     .setTitle("**Prison**")
  69.     .addField("Prisoned User", `${toprison} with ID ${toprison.id}`)
  70.     .addField("Prisoned In", message.channel)
  71.     .addField("Length", prisontime)
  72.     .addField("Reason", reason);
  73.  
  74.   let unprisonembed = new Discord.RichEmbed()
  75.     .setAuthor(toprison.user.username, toprison.user.displayAvatarURL)
  76.     .setTitle("**UnPrison**")
  77.     .setColor("GREEN")
  78.     .addField("UnPrisoned User", toprison)
  79.     .addField("Reason", "Auto");
  80.  
  81.   let logchannel = message.guild.channels.get("638413285838028822");
  82.  
  83.   await toprison.addRole(prisonrole.id).then(() => {
  84.     message.delete();
  85.     mutee.send(`Hey, you have been prisoned in ${message.guild.name} for ${reason}`).catch(err => console.log(err));
  86.  
  87.   });;;
  88.  
  89.   await toprison.removeRole("425363744340836373");
  90.   logchannel.send(prisonembed);
  91.  
  92.   setTimeout(async function() {
  93.     logchannel.send(unprisonembed);
  94.     await toprison.removeRole(prisonrole.id).then(() => {
  95.     message.delete();
  96.     mutee.send("Hey, you have been unprisoned in ${message.guild.name}").catch(err => console.log(err));;
  97.       });;
  98.     await toprison.addRole("425363744340836373");
  99.   }, ms(prisontime));
  100. };
  101.  
  102. exports.conf = {
  103.   enable: true,
  104.   aliases: []
  105. };
  106.  
  107. exports.help = {
  108.   name: "prison",
  109.   usage: "prison <user> <time> <reason>",
  110.   desc: "Send user to prison with length time"
  111. };
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top