Advertisement
Andrey0189

Untitled

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