Andrey0189

Untitled

Jun 22nd, 2018
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. let unmuted = false
  2.  
  3.             if (['unmute', 'гтьгеу'].includes(command)) {
  4.  
  5.                 if (message.member.roles.some(r=> [moder, owner].includes(r.id))) {
  6.  
  7.                 let user = message.mentions.members.first();
  8.                 if (!user) {
  9.                     message.channel.send(message.author + ', Ошибка. Причина: **Вы забыли упомянуть пользователя или хотите размутить того, кто не является пользователем**');
  10.                     return
  11.                 } else {
  12.                     let reason = args.join(" ").replace(user, '');
  13.                         user.removeRole(muted);
  14.                         message.channel.send(user + ' был размучен');
  15.                         if (!reason) reason = ' Не указана'
  16.                         const embed = new Discord.RichEmbed()
  17.                             .setTitle("Информация о муте")
  18.                             .setColor("af00ff")
  19.                             .setDescription('Вы были **размучены** пользователем ' + message.author + '.\n\nПричина:**' + reason + '.**')
  20.                             .setFooter(bot_name + " | " + version + " | Все права защищены")
  21.                             .setTimestamp();
  22.                         user.send({embed});
  23.                         unmuted = true
  24.                 }
  25.             } else {
  26.                 message.channel.send(message.author + ', Ошибка. Причина: **Вы не можете использовать команду unmute, вы должны иметь роль Модератор**');
  27.             }
  28.             }
  29.    
  30. if (['ьгеу', 'mute', 'мут'].includes(command) && message.member.roles.some(r=>[moder, owner].includes(r.id))) {
  31.     let user = message.mentions.members.first();
  32.  
  33.     if (message.member.roles.some(r=> [moder, owner].includes(r.id))) {
  34.    
  35.     if (!user)
  36.         return message.channel.send(message.author + ', Ошибка. Причина: **Вы забыли упомянуть пользователя или вы хотите замутить того, кто не является пользователем**');
  37.  
  38.     /*if (user.id == message.author.id) {
  39.         message.channel.send('Зачем ты пытаешься замутить самого себя?');
  40.         return;
  41.     }*/
  42.     function getSeconds(str) {
  43.         let seconds = 0;
  44.         let years = str.match(/(\d+)\s*y/);
  45.         let months = str.match(/(\d+)\s*M/);
  46.         let weeks = str.match(/(\d+)\s*w/);
  47.         let days = str.match(/(\d+)\s*d/);
  48.         let hours = str.match(/(\d+)\s*h/);
  49.         let minutes = str.match(/(\d+)\s*m/);
  50.         let secs = str.match(/(\d+)\s*s/);
  51.         if (years) { seconds += parseInt(years[1])*31556926; }
  52.         if (months) { seconds += parseInt(months[1])*2592000; }
  53.         if (weeks) { seconds += parseInt(weeks[1])*604800; }
  54.         if (days) { seconds += parseInt(days[1])*86400; }
  55.         if (hours) { seconds += parseInt(hours[1])*3600; }
  56.         if (minutes) { seconds += parseInt(minutes[1])*60; }
  57.         if (secs) { seconds += parseInt(secs[1]); }
  58.         return seconds;
  59.     }
  60.  
  61.     user.addRole(muted);
  62.     message.channel.send(user + ' был успешно замучен');
  63.  
  64.     let reason = args.join(" ").replace(user, '');
  65.     reason = reason.replace(args[1], '');
  66.     reason = reason.replace(' ', '');
  67.  
  68.     if (!reason) {
  69.         reason = ' Не указана'
  70.     }
  71.     const embed = new Discord.RichEmbed()
  72.                 .setTitle("Информация о муте")
  73.                 .setColor("af00ff")
  74.                 .setDescription('Вы были **замучены** пользователем ' + message.author + '\n\nВремя: **'+ args[1] + '.**\nПричина:**' + reason + '.**\n\nНе ведите себя плохо!')
  75.                 .setFooter(bot_name + " | " + version + " | Все права защищены")
  76.                 .setTimestamp();
  77.                 user.send({embed});
  78.  
  79.  
  80.     if (args[1] && getSeconds(args[1]) !== 0 )
  81.  
  82.     if (unmuted) {
  83.         unmuted = false
  84.         return
  85.     }
  86.  
  87.     setBigTimeout(() => {
  88.         const embedAutoUnmute = new Discord.RichEmbed()
  89.         .setTitle("Информация о муте")
  90.         .setColor("af00ff")
  91.         .setDescription('Вы были автоматически **размучены**.\n\nПричина: **Автоматический размут.**')
  92.         .setFooter(bot_name + " | " + version + " | Все права защищены")
  93.         .setTimestamp();
  94.         user.send({embed: embedAutoUnmute});
  95.         user.removeRole(muted);
  96.         message.channel.send(user + ' был размучен');}, getSeconds(args[1])*1000);
  97.         } else {
  98.             message.channel.send(message.author + ', Ошибка. Причина: **Вы не можете использовать команду mute, вы должны иметь роль Модератор**');
  99.         }
  100.     }
Advertisement
Add Comment
Please, Sign In to add comment