Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if (['ьгеу', 'mute', 'мут'].includes(command) && message.member.roles.some(r=>[moder, owner].includes(r.id))) {
- let user = message.mentions.members.first();
- if (!user)
- return message.channel.send(message.author + ', Ошибка. Причина: *`Вы забыли упомянуть пользователя или вы хотите замутить того кто не является пользователем`*');
- /*if (user.id == message.author.id) {
- message.channel.send('Зачем ты пытаешься замутить самого себя?');
- return;
- }*/
- function getSeconds(str) {
- let seconds = 0;
- let years = str.match(/(\d+)\s*y/);
- let months = str.match(/(\d+)\s*M/);
- let weeks = str.match(/(\d+)\s*w/);
- let days = str.match(/(\d+)\s*d/);
- let hours = str.match(/(\d+)\s*h/);
- let minutes = str.match(/(\d+)\s*m/);
- let secs = str.match(/(\d+)\s*s/);
- if (years) { seconds += parseInt(years[1])*31556926; }
- if (months) { seconds += parseInt(months[1])*2592000; }
- if (weeks) { seconds += parseInt(weeks[1])*604800; }
- if (days) { seconds += parseInt(days[1])*86400; }
- if (hours) { seconds += parseInt(hours[1])*3600; }
- if (minutes) { seconds += parseInt(minutes[1])*60; }
- if (secs) { seconds += parseInt(secs[1]); }
- return seconds;
- }
- user.addRole(muted);
- message.channel.send(user + ' был успешно замучен');
- let reason = args.join(" ").replace(user, '');
- reason = reason.replace(args[1], '');
- reason = reason.replace(' ', '');
- if (!reason) {
- reason = ' Не указана'
- }
- const embed = new Discord.RichEmbed()
- .setTitle("Информация о муте")
- .setColor("af00ff")
- .setDescription('Вы были **замучены** пользователем ' + message.author + '\n\nВремя: **'+ args[1] + '**.\nПричина:**' + reason + '**.\n\nНе ведите себя плохо!')
- .setFooter(bot_name + " | " + version + " | Все права защищены")
- .setTimestamp();
- user.send({embed});
- if (args[1] && getSeconds(args[1]) !== 0 )
- if (['unmute', 'гтьгеу'].includes(command)) {
- let user = message.mentions.members.first();
- if (!user) {
- message.channel.send(message.author + ', Ошибка. Причина: *`Вы забыли упомянуть пользователя или хотите размутить того кто не является пользователем`*');
- return
- } else {
- let reason = args.join(" ").replace(user, '');
- user.removeRole(muted);
- message.channel.send(user + ' был размучен');
- if (!reason) reason = 'Не указана'
- const embed = new Discord.RichEmbed()
- .setTitle("Информация о муте")
- .setColor("af00ff")
- .setDescription('Вы были **размучены** пользователем ' + message.author + '.\n\nПричина: **' + reason + '.**')
- .setFooter(bot_name + " | " + version + " | Все права защищены")
- .setTimestamp();
- user.send({embed});
- unmuted = true
- }
- }
- if (unmuted) {
- unmuted = false
- return
- }
- const embedAutoUnmute = new Discord.RichEmbed()
- .setTitle("Информация о муте")
- .setColor("af00ff")
- .setDescription('Вы были автоматически **размучены**.\n\nПричина: **Автоматический размут.**')
- .setFooter(bot_name + " | " + version + " | Все права защищены")
- .setTimestamp();
- setBigTimeout(() => {
- user.send({embed: embedAutoUnmute});
- user.removeRole(muted);
- message.channel.send(user + ' был размучен');}, getSeconds(args[1])*1000);
- }
- if (['unmute', 'гтьгеу'].includes(command)) {
- message.channel.send(message.author + ', Ошибка. Причина: *`Пользователь и так был не замучен`*')
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement