const Discord = require('discord.js'); exports.run = (client, message, args) => { if (!message.guild) { const ozelmesajuyari = new Discord.RichEmbed() .setDescription(`You can not use commands here.`) return message.author.sendEmbed(ozelmesajuyari); } if (!message.guild.member(message.author).hasPermission("MANAGE_MESSAGES")) return message.channel.send(`<:hata:389075761895702538> | You don't have permission for this command.`); let user = message.mentions.users.first(); let str = `<@${user.id}>`; let id = str.replace(/[<@!>]/g, ''); let guild = message.guild let reason = args.slice(1).join(' '); let modlog = guild.channels.find('name', 'mod-log'); if (!modlog) return message.channel.send('<:hata:389075761895702538> | **#mod-log** is not found, please create **mod-log** channel.'); if (reason.length < 1) return message.channel.send('<:hata:389075761895702538> | You should write the reason for the warn.'); if (message.mentions.users.size < 1) return message.channel.send('<:hata:389075761895702538> | You must choose a user.').catch(console.error); message.channel.send(`<:basari:389075372064636929> | Succesfully! ${args[0]} is alerted.`); const embed = new Discord.RichEmbed() .setColor('RANDOM') .addField('❯ You are alerted by:', `**»** <@${message.author.id}>`, true) .addField('❯ Server name:', `**»** ${message.guild.name}`, true) .addField('❯ Alert reason:', `**»** ${reason}`) client.fetchUser(id) .then(user => {user.send({embed})}) return guild.channels.get(modlog.id).sendEmbed(new Discord.RichEmbed() .addField('Authrorized', `» <@${message.author.id}> (${message.author.id})`) .addField('User', `» ${args[0]} (${user.id})`) .addField('Reason for', '» '+ reason +'') .setFooter('Warn Member') .setColor('RANDOM') .setTimestamp()); }; exports.conf = { enabled: true, guildOnly: true, aliases: ['alert', 'warn', 'warning'], permLevel: 2 }; exports.help = { name: 'uyar', description: 'İstediğiniz kişiyi uyarır.', usage: 'uyar [kullanıcı] [sebep]' };