Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- let antibots = JSON.parse(fs.readFileSync('./antibots.json' , 'utf8'));//require antihack.json file
- client.on('message', message => {
- if(message.content.startsWith(prefix + "antibots on")){
- if(!message.channel.guild) return;
- if(!message.member.hasPermission('ADMINISTRATOR')) return;
- antibots[message.guild.id] = {
- onoff: 'On',
- }
- message.channel.send(`**<a:true:593078038166503451> | \`ON\`.**`)
- fs.writeFile("./antibots.json", JSON.stringify(antibots), (err) => {
- if (err) console.error(err)
- .catch(err => {
- console.error(err);
- });
- });
- }
- })
- client.on('message', message => {
- if(message.content.startsWith(prefix + "antibots off")) {
- if(!message.channel.guild) return;
- if(!message.member.hasPermission('ADMINISTRATOR')) return;
- antibots[message.guild.id] = {
- onoff: 'Off',
- }
- message.channel.send(`**<a:true:593078038166503451> | \`OFF\`.**`)
- fs.writeFile("./antibots.json", JSON.stringify(antibots), (err) => {
- if (err) console.error(err)
- .catch(err => {
- console.error(err);
- });
- });
- }
- })
- client.on("guildMemberAdd", member => {
- if(!antibots[member.guild.id]) antibots[member.guild.id] = {
- onoff: 'Off'
- }
- if(antibots[member.guild.id].onoff === 'Off') return;
- if(member.user.bot) return member.kick()
- })
- fs.writeFile("./antibots.json", JSON.stringify(antibots), (err) => {
- if (err) console.error(err)
- .catch(err => {
- console.error(err);
- });
- })
- const pics = JSON.parse(fs.readFileSync('./pics.json' , 'utf8'));
- client.on('message', message => {
- if (!message.channel.guild) return;
- let room = message.content.split(" ").slice(1);
- let findroom = message.guild.channels.find('name', `${room}`)
- if(message.content.startsWith(prefix + "setMedia")) {
- if(!message.channel.guild) return;
- if(!message.member.hasPermission('MANAGE_GUILD')) return message.channel.send('**Sorry But You Dont Have Permission** `MANAGE_GUILD`' );
- if(!room) return message.channel.send('Please Type The Channel Name')
- if(!findroom) return message.channel.send('Cant Find This Channel')
- let embed = new Discord.RichEmbed()
- .setTitle('**Done The MediaOnly Code Has Been Setup**')
- .addField('Channel:', `${room}`)
- .addField('Requested By', `${message.author}`)
- .setThumbnail(message.author.avatarURL)
- .setFooter(`${client.user.username}`)
- message.channel.sendEmbed(embed)
- pics[message.guild.id] = {
- channel: room,
- onoff: 'On'
- },
- fs.writeFile("./pics.json", JSON.stringify(pics), (err) => {
- if (err) console.error(err)
- })
- }})
- client.on('message', message => {
- if(message.content.startsWith(prefix + "toggleMedia")) {
- if (!message.channel.guild) return;
- if(!message.channel.guild) return;
- if(!message.member.hasPermission('MANAGE_GUILD')) return message.channel.send('**Sorry But You Dont Have Permission** `MANAGE_GUILD`' );
- if(!pics[message.guild.id]) pics[message.guild.id] = {
- onoff: 'Off'
- }
- if(pics[message.guild.id].onoff === 'Off') return [message.channel.send(`**The MediaCode Is __????__ !**`), pics[message.guild.id].onoff = 'On']
- if(pics[message.guild.id].onoff === 'On') return [message.channel.send(`**The MediaCode Is __??????__ !**`), pics[message.guild.id].onoff = 'Off']
- fs.writeFile("./pics.json", JSON.stringify(pics), (err) => {
- if (err) console.error(err)
- })
- }
- })
- client.on('message', message => {
- if (!message.channel.guild) return;
- if(message.author.bot) return;
- if(!pics[message.guild.id]) pics[message.guild.id] = {
- onoff: 'Off'
- }
- if(pics[message.guild.id].onoff === 'Off') return;
- if(message.channel.name !== `${pics[message.guild.id].channel}`) return;
- let types = [
- 'jpg',
- 'jpeg',
- 'png',
- 'http://prntscr.com/'
- ]
- if (message.attachments.size <= 0) {
- message.delete();
- message.channel.send(`${message.author}, This Channel For Media ??? Only !`)
- .then(msg => {
- setTimeout(() => {
- msg.delete();
- }, 5000)
- })
- return;
- }
- if(message.attachments.size >= 1) {
- let filename = message.attachments.first().filename
- console.log(filename);
- if(!types.some( type => filename.endsWith(type) )) {
- message.delete();
- message.channel.send(`${message.author}, This Channel For Media ??? Only !`)
- .then(msg => {
- setTimeout(() => {
- msg.delete();
- }, 5000)
- })
- .catch(err => {
- console.error(err);
- });
- }
- }
- })
- client.on('message', message => {
- if(message.content.startsWith(prefix + "infoMedia")) {
- let embed = new Discord.RichEmbed()
- .addField('Channel Status', `${pics[message.guild.id].onoff}`)
- .addField('Media Channel', `${pics[message.guild.id].channel}`)
- .addField('Requested By', `${message.author}`)
- .setThumbnail(message.author.avatarURL)
- .setFooter(`${client.user.username}`)
- message.channel.sendEmbed(embed)
- }})
- let link= JSON.parse(fs.readFileSync('./link.json' , 'utf8'));
- client.on('message', message => {
- if(message.content.startsWith(prefix + "settings toggleLink")) {
- if(!message.channel.guild) return message.reply('**This Command Only For Servers**');
- if(!message.member.hasPermission('MANAGE_GUILD')) return message.channel.send('**Sorry But You Dont Have Permission** `MANAGE_GUILD`' );
- if(!link[message.guild.id]) link[message.guild.id] = {
- onoff: 'Off'
- }
- if(link[message.guild.id].onoff === 'Off') return [message.channel.send(`**? The Invite Link Cmd Is __????__ !**`), link[message.guild.id].onoff = 'On']
- if(link[message.guild.id].onoff === 'On') return [message.channel.send(`**? The Invite Link Cmd Is __??????__ !**`), link[message.guild.id].onoff = 'Off']
- fs.writeFile("./link.json", JSON.stringify(link), (err) => {
- if (err) console.error(err)
- .catch(err => {
- console.error(err);
- });
- });
- }
- })
- const coolDown = new Set();
- client.on('message', message => {
- if (message.content.startsWith("رابط")) {
- if(!message.channel.guild) return message.reply('**This Command Only For Servers**');
- if(!link[message.guild.id]) link[message.guild.id] = {
- onoff: 'Off'
- }
- if(link[message.guild.id].onoff === 'Off') return;
- if(coolDown.has(message.author.id)) return message.channel.send(`**:stopwatch: | ${message.author.username}, your invite :yen: link refreshes in \`\`1 Day\`\`.**`);
- message.channel.createInvite({
- thing: true,
- maxUses: 5,
- maxAge: 86400
- }).then(invite =>
- message.author.sendMessage(invite.url)
- )
- message.channel.send("**تم ارسال الرابط برسالة خاصة**") .then(() => {
- coolDown.add(message.author.id);
- });
- message.author.send(`**مدة الرابط : يـوم
- عدد استخدامات الرابط : 5**`)
- }
- setTimeout(() => {
- coolDown.remove(message.author.id);
- },86400000);
- });
- let log= JSON.parse(fs.readFileSync('./log.json' , 'utf8'));
- client.on('message', message => {
- if (!message.channel.guild) return;
- let room = message.content.split(" ").slice(1);
- let findroom = message.guild.channels.find('name', `${room}`)
- if(message.content.startsWith(prefix + "setLog")) {
- if(!message.channel.guild) return;
- if(!message.member.hasPermission('MANAGE_GUILD')) return message.channel.send('**Sorry But You Dont Have Permission** `MANAGE_GUILD`' );
- if(!room) return message.channel.send('Please Type The Channel Name')
- if(!findroom) return message.channel.send('Please Type The Log Channel Name')
- let embed = new Discord.RichEmbed()
- .setTitle('**Done The Log Code Has Been Setup**')
- .addField('Channel:', `${room}`)
- .addField('Requested By:', `${message.author}`)
- .setThumbnail(message.author.avatarURL)
- .setFooter(`${client.user.username}`)
- message.channel.sendEmbed(embed)
- log[message.guild.id] = {
- channel: room,
- onoff: 'On'
- }
- fs.writeFile("./log.json", JSON.stringify(log), (err) => {
- if (err) console.error(err)
- })
- }})
- client.on('message', message => {
- if(message.content.startsWith(prefix + "toggleLog")) {
- if(!message.channel.guild) return;
- if(!message.member.hasPermission('MANAGE_GUILD')) return message.channel.send('**Sorry But You Dont Have Permission** `MANAGE_GUILD`' );
- if(!log[message.guild.id]) log[message.guild.id] = {
- onoff: 'Off'
- }
- if(log[message.guild.id].onoff === 'Off') return [message.channel.send(`**The log Is __????__ !**`), log[message.guild.id].onoff = 'On']
- if(log[message.guild.id].onoff === 'On') return [message.channel.send(`**The log Is __??????__ !**`), log[message.guild.id].onoff = 'Off']
- fs.writeFile("./log.json", JSON.stringify(log), (err) => {
- if (err) console.error(err)
- .catch(err => {
- console.error(err);
- });
- });
- }
- })
- client.on('messageDelete', message => {
- if(message.author.bot) return;
- if(message.channel.type === 'dm') return;
- if(!message.guild.member(client.user).hasPermission('EMBED_LINKS')) return;
- if(!message.guild.member(client.user).hasPermission('MANAGE_MESSAGES')) return;
- if(!log[message.guild.id]) log[message.guild.id] = {
- onoff: 'Off'
- }
- if(log[message.guild.id].onoff === 'Off') return;
- var logChannel = message.guild.channels.find(c => c.name === `${log[message.guild.id].channel}`);
- if(!logChannel) return;
- let messageDelete = new Discord.RichEmbed()
- .setTitle('**[MESSAGE DELETE]**')
- .setColor('RED')
- .setThumbnail(message.author.avatarURL)
- .setDescription(`**\n**:wastebasket: Successfully \`\`DELETE\`\` **MESSAGE** In ${message.channel}\n\n**Channel:** \`\`${message.channel.name}\`\` (ID: ${message.channel.id})\n**Message ID:** ${message.id}\n**Sent By:** <@${message.author.id}> (ID: ${message.author.id})\n**Message:**\n\`\`\`${message}\`\`\``)
- .setTimestamp()
- .setFooter(message.guild.name, message.guild.iconURL)
- logChannel.send(messageDelete);
- });
- client.on('messageUpdate', (oldMessage, newMessage) => {
- if(oldMessage.author.bot) return;
- if(!oldMessage.channel.type === 'dm') return;
- if(!oldMessage.guild.member(client.user).hasPermission('EMBED_LINKS')) return;
- if(!oldMessage.guild.member(client.user).hasPermission('MANAGE_MESSAGES')) return;
- if(!log[oldMessage.guild.id]) log[oldMessage.guild.id] = {
- onoff: 'Off'
- }
- if(log[oldMessage.guild.id].onoff === 'Off') return;
- var logChannel = oldMessage.guild.channels.find(c => c.name === `${log[oldMessage.guild.id].channel}`);
- if(!logChannel) return;
- if(oldMessage.content.startsWith('https://')) return;
- let messageUpdate = new Discord.RichEmbed()
- .setTitle('**[MESSAGE EDIT]**')
- .setThumbnail(oldMessage.author.avatarURL)
- .setColor('BLUE')
- .setDescription(`**\n**:wrench: Successfully \`\`EDIT\`\` **MESSAGE** In ${oldMessage.channel}\n\n**Channel:** \`\`${oldMessage.channel.name}\`\` (ID: ${oldMessage.channel.id})\n**Message ID:** ${oldMessage.id}\n**Sent By:** <@${oldMessage.author.id}> (ID: ${oldMessage.author.id})\n\n**Old Message:**\`\`\`${oldMessage}\`\`\`\n**New Message:**\`\`\`${newMessage}\`\`\``)
- .setTimestamp()
- .setFooter(oldMessage.guild.name, oldMessage.guild.iconURL)
- logChannel.send(messageUpdate);
- });
- client.on('roleCreate', role => {
- if(!role.guild.member(client.user).hasPermission('EMBED_LINKS')) return;
- if(!role.guild.member(client.user).hasPermission('VIEW_AUDIT_LOG')) return;
- if(!log[role.guild.id]) log[role.guild.id] = {
- onoff: 'Off'
- }
- if(log[role.guild.id].onoff === 'Off') return;
- var logChannel = role.guild.channels.find(c => c.name === `${log[role.guild.id].channel}`);
- if(!logChannel) return;
- role.guild.fetchAuditLogs().then(logs => {
- var userID = logs.entries.first().executor.id;
- var userAvatar = logs.entries.first().executor.avatarURL;
- let roleCreate = new Discord.RichEmbed()
- .setTitle('**[ROLE CREATE]**')
- .setThumbnail(userAvatar)
- .setDescription(`**\n**:white_check_mark: Successfully \`\`CREATE\`\` Role.\n\n**Role Name:** \`\`${role.name}\`\` (ID: ${role.id})\n**By:** <@${userID}> (ID: ${userID})`)
- .setColor('GREEN')
- .setTimestamp()
- .setFooter(role.guild.name, role.guild.iconURL)
- logChannel.send(roleCreate);
- })
- });
- client.on('roleDelete', role => {
- if(!role.guild.member(client.user).hasPermission('EMBED_LINKS')) return;
- if(!role.guild.member(client.user).hasPermission('VIEW_AUDIT_LOG')) return;
- if(!log[role.guild.id]) log[role.guild.id] = {
- onoff: 'Off'
- }
- if(log[role.guild.id].onoff === 'Off') return;
- var logChannel = role.guild.channels.find(c => c.name === `${log[role.guild.id].channel}`);
- if(!logChannel) return;
- role.guild.fetchAuditLogs().then(logs => {
- var userID = logs.entries.first().executor.id;
- var userAvatar = logs.entries.first().executor.avatarURL;
- let roleDelete = new Discord.RichEmbed()
- .setTitle('**[ROLE DELETE]**')
- .setThumbnail(userAvatar)
- .setDescription(`**\n**:white_check_mark: Successfully \`\`DELETE\`\` Role.\n\n**Role Name:** \`\`${role.name}\`\` (ID: ${role.id})\n**By:** <@${userID}> (ID: ${userID})`)
- .setColor('RED')
- .setTimestamp()
- .setFooter(role.guild.name, role.guild.iconURL)
- logChannel.send(roleDelete);
- })
- });
- client.on('roleUpdate', (oldRole, newRole) => {
- if(!oldRole.guild.member(client.user).hasPermission('EMBED_LINKS')) return;
- if(!oldRole.guild.member(client.user).hasPermission('VIEW_AUDIT_LOG')) return;
- if(!log[oldRole.guild.id]) log[oldRole.guild.id] = {
- onoff: 'Off'
- }
- if(log[oldRole.guild.id].onoff === 'Off') return;
- var logChannel = oldRole.guild.channels.find(c => c.name === `${log[oldRole.guild.id].channel}`);
- if(!logChannel) return;
- oldRole.guild.fetchAuditLogs().then(logs => {
- var userID = logs.entries.first().executor.id;
- var userAvatar = logs.entries.first().executor.avatarURL;
- if(oldRole.name !== newRole.name) {
- if(log[oldRole.guild.id].onoff === 'Off') return;
- let roleUpdateName = new Discord.RichEmbed()
- .setTitle('**[ROLE NAME UPDATE]**')
- .setThumbnail(userAvatar)
- .setColor('BLUE')
- .setDescription(`**\n**:white_check_mark: Successfully \`\`EDITED\`\` Role Name.\n\n**Old Name:** \`\`${oldRole.name}\`\`\n**New Name:** \`\`${newRole.name}\`\`\n**Role ID:** ${oldRole.id}\n**By:** <@${userID}> (ID: ${userID})`)
- .setTimestamp()
- .setFooter(oldRole.guild.name, oldRole.guild.iconURL)
- logChannel.send(roleUpdateName);
- }
- if(oldRole.hexColor !== newRole.hexColor) {
- if(oldRole.hexColor === '#000000') {
- var oldColor = '`Default`';
- }else {
- var oldColor = oldRole.hexColor;
- }
- if(newRole.hexColor === '#000000') {
- var newColor = '`Default`';
- }else {
- var newColor = newRole.hexColor;
- }
- if(log[oldRole.guild.id].onoff === 'Off') return;
- let roleUpdateColor = new Discord.RichEmbed()
- .setTitle('**[ROLE COLOR UPDATE]**')
- .setThumbnail(userAvatar)
- .setColor('BLUE')
- .setDescription(`**\n**:white_check_mark: Successfully \`\`EDITED\`\` **${oldRole.name}** Role Color.\n\n**Old Color:** ${oldColor}\n**New Color:** ${newColor}\n**Role ID:** ${oldRole.id}\n**By:** <@${userID}> (ID: ${userID})`)
- .setTimestamp()
- .setFooter(oldRole.guild.name, oldRole.guild.iconURL)
- logChannel.send(roleUpdateColor);
- }
- })
- });
- client.on('channelCreate', channel => {
- if(!channel.guild) return;
- if(!channel.guild.member(client.user).hasPermission('EMBED_LINKS')) return;
- if(!channel.guild.member(client.user).hasPermission('VIEW_AUDIT_LOG')) return;
- if(!log[channel.guild.id]) log[channel.guild.id] = {
- onoff: 'Off'
- }
- if(log[channel.guild.id].onoff === 'Off') return;
- var logChannel = channel.guild.channels.find(c => c.name === `${log[channel.guild.id].channel}`);
- if(!logChannel) return;
- if(channel.type === 'text') {
- var roomType = 'Text';
- }else
- if(channel.type === 'voice') {
- var roomType = 'Voice';
- }else
- if(channel.type === 'category') {
- var roomType = 'Category';
- }
- channel.guild.fetchAuditLogs().then(logs => {
- var userID = logs.entries.first().executor.id;
- var userAvatar = logs.entries.first().executor.avatarURL;
- let channelCreate = new Discord.RichEmbed()
- .setTitle('**[CHANNEL CREATE]**')
- .setThumbnail(userAvatar)
- .setDescription(`**\n**:white_check_mark: Successfully \`\`CREATE\`\` **${roomType}** channel.\n\n**Channel Name:** \`\`${channel.name}\`\` (ID: ${channel.id})\n**By:** <@${userID}> (ID: ${userID})`)
- .setColor('GREEN')
- .setTimestamp()
- .setFooter(channel.guild.name, channel.guild.iconURL)
- logChannel.send(channelCreate);
- })
- });
- client.on('channelDelete', channel => {
- if(!channel.guild) return;
- if(!channel.guild.member(client.user).hasPermission('EMBED_LINKS')) return;
- if(!channel.guild.member(client.user).hasPermission('VIEW_AUDIT_LOG')) return;
- if(!log[channel.guild.id]) log[channel.guild.id] = {
- onoff: 'Off'
- }
- if(log[channel.guild.id].onoff === 'Off') return;
- var logChannel = channel.guild.channels.find(c => c.name === `${log[channel.guild.id].channel}`);
- if(!logChannel) return;
- if(channel.type === 'text') {
- var roomType = 'Text';
- }else
- if(channel.type === 'voice') {
- var roomType = 'Voice';
- }else
- if(channel.type === 'category') {
- var roomType = 'Category';
- }
- channel.guild.fetchAuditLogs().then(logs => {
- var userID = logs.entries.first().executor.id;
- var userAvatar = logs.entries.first().executor.avatarURL;
- let channelDelete = new Discord.RichEmbed()
- .setTitle('**[CHANNEL DELETE]**')
- .setThumbnail(userAvatar)
- .setDescription(`**\n**:white_check_mark: Successfully \`\`DELETE\`\` **${roomType}** channel.\n\n**Channel Name:** \`\`${channel.name}\`\` (ID: ${channel.id})\n**By:** <@${userID}> (ID: ${userID})`)
- .setColor('RED')
- .setTimestamp()
- .setFooter(channel.guild.name, channel.guild.iconURL)
- logChannel.send(channelDelete);
- })
- });
- client.on('channelUpdate', (oldChannel, newChannel) => {
- if(!oldChannel.guild) return;
- if(!log[oldChannel.guild.id]) log[oldChannel.guild.id] = {
- onoff: 'Off'
- }
- if(log[oldChannel.guild.id].onoff === 'Off') return;
- var logChannel = oldChannel.guild.channels.find(c => c.name === `${log[oldChannel.guild.id].channel}`);
- if(!logChannel) return;
- if(oldChannel.type === 'text') {
- var channelType = 'Text';
- }else
- if(oldChannel.type === 'voice') {
- var channelType = 'Voice';
- }else
- if(oldChannel.type === 'category') {
- var channelType = 'Category';
- }
- oldChannel.guild.fetchAuditLogs().then(logs => {
- var userID = logs.entries.first().executor.id;
- var userAvatar = logs.entries.first().executor.avatarURL;
- if(oldChannel.name !== newChannel.name) {
- let newName = new Discord.RichEmbed()
- .setTitle('**[CHANNEL EDIT]**')
- .setThumbnail(userAvatar)
- .setColor('BLUE')
- .setDescription(`**\n**:wrench: Successfully Edited **${channelType}** Channel Name\n\n**Old Name:** \`\`${oldChannel.name}\`\`\n**New Name:** \`\`${newChannel.name}\`\`\n**Channel ID:** ${oldChannel.id}\n**By:** <@${userID}> (ID: ${userID})`)
- .setTimestamp()
- .setFooter(oldChannel.guild.name, oldChannel.guild.iconURL)
- logChannel.send(newName);
- }
- if(oldChannel.topic !== newChannel.topic) {
- if(log[oldChannel.guild.id].onoff === 'Off') return;
- let newTopic = new Discord.RichEmbed()
- .setTitle('**[CHANNEL EDIT]**')
- .setThumbnail(userAvatar)
- .setColor('BLUE')
- .setDescription(`**\n**:wrench: Successfully Edited **${channelType}** Channel Topic\n\n**Old Topic:**\n\`\`\`${oldChannel.topic || 'NULL'}\`\`\`\n**New Topic:**\n\`\`\`${newChannel.topic || 'NULL'}\`\`\`\n**Channel:** ${oldChannel} (ID: ${oldChannel.id})\n**By:** <@${userID}> (ID: ${userID})`)
- .setTimestamp()
- .setFooter(oldChannel.guild.name, oldChannel.guild.iconURL)
- logChannel.send(newTopic);
- }
- })
- });
- client.on('guildBanAdd', (guild, user) => {
- if(!guild.member(client.user).hasPermission('EMBED_LINKS')) return;
- if(!guild.member(client.user).hasPermission('VIEW_AUDIT_LOG')) return;
- if(!log[user.guild.id]) log[guild.guild.id] = {
- onoff: 'Off'
- }
- if(log[user.guild.id].onoff === 'Off') return;
- var logChannel = guild.channels.find(c => c.name === `${log[guild.guild.id].channel}`);
- if(!logChannel) return;
- guild.fetchAuditLogs().then(logs => {
- var userID = logs.entries.first().executor.id;
- var userAvatar = logs.entries.first().executor.avatarURL;
- if(userID === client.user.id) return;
- let banInfo = new Discord.RichEmbed()
- .setTitle('**[BANNED]**')
- .setThumbnail(userAvatar)
- .setColor('DARK_RED')
- .setDescription(`**\n**:airplane: Successfully \`\`BANNED\`\` **${user.username}** From the server!\n\n**User:** <@${user.id}> (ID: ${user.id})\n**By:** <@${userID}> (ID: ${userID})`)
- .setTimestamp()
- .setFooter(guild.name, guild.iconURL)
- logChannel.send(banInfo);
- })
- });
- client.on('guildBanRemove', (guild, user) => {
- if(!guild.member(client.user).hasPermission('EMBED_LINKS')) return;
- if(!guild.member(client.user).hasPermission('VIEW_AUDIT_LOG')) return;
- if(!log[guild.guild.id]) log[guild.guild.id] = {
- onoff: 'Off'
- }
- if(log[guild.guild.id].onoff === 'Off') return;
- var logChannel = guild.channels.find(c => c.name === `${log[guild.guild.id].channel}`);
- if(!logChannel) return;
- guild.fetchAuditLogs().then(logs => {
- var userID = logs.entries.first().executor.id;
- var userAvatar = logs.entries.first().executor.avatarURL;
- if(userID === client.user.id) return;
- let unBanInfo = new Discord.RichEmbed()
- .setTitle('**[UNBANNED]**')
- .setThumbnail(userAvatar)
- .setColor('GREEN')
- .setDescription(`**\n**:unlock: Successfully \`\`UNBANNED\`\` **${user.username}** From the server\n\n**User:** <@${user.id}> (ID: ${user.id})\n**By:** <@${userID}> (ID: ${userID})`)
- .setTimestamp()
- .setFooter(guild.name, guild.iconURL)
- logChannel.send(unBanInfo);
- })
- });
- client.on('guildMemberUpdate', (oldMember, newMember) => {
- if(!oldMember.guild) return;
- if(!log[oldMember.guild.id]) log[oldMember.guild.id] = {
- onoff: 'Off'
- }
- if(log[oldMember.guild.id].onoff === 'Off') return;
- var logChannel = oldMember.guild.channels.find(c => c.name === `${log[oldMember, newMember.guild.id].channel}`);
- if(!logChannel) return;
- oldMember.guild.fetchAuditLogs().then(logs => {
- var userID = logs.entries.first().executor.id;
- var userAvatar = logs.entries.first().executor.avatarURL;
- var userTag = logs.entries.first().executor.tag;
- if(oldMember.nickname !== newMember.nickname) {
- if(oldMember.nickname === null) {
- var oldNM = '`His Orginal Name`';
- }else {
- var oldNM = oldMember.nickname;
- }
- if(newMember.nickname === null) {
- var newNM = '`His Orginal Name`';
- }else {
- var newNM = newMember.nickname;
- }
- let updateNickname = new Discord.RichEmbed()
- .setTitle('**[UPDATE MEMBER NICKNAME]**')
- .setThumbnail(userAvatar)
- .setColor('BLUE')
- .setDescription(`**\n**:spy: Successfully \`\`CHANGE\`\` Member Nickname.\n\n**User:** ${oldMember} (ID: ${oldMember.id})\n**Old Nickname:** ${oldNM}\n**New Nickname:** ${newNM}\n**By:** <@${userID}> (ID: ${userID})`)
- .setTimestamp()
- .setFooter(oldMember.guild.name, oldMember.guild.iconURL)
- logChannel.send(updateNickname);
- }
- if(oldMember.roles.size < newMember.roles.size) {
- let role = newMember.roles.filter(r => !oldMember.roles.has(r.id)).first();
- if(!log[oldMember.guild.id]) log[oldMember.guild.id] = {
- onoff: 'Off'
- }
- if(log[oldMember.guild.id].onoff === 'Off') return;
- let roleAdded = new Discord.RichEmbed()
- .setTitle('**[ADDED ROLE TO MEMBER]**')
- .setThumbnail(oldMember.guild.iconURL)
- .setColor('GREEN')
- .setDescription(`**\n**:white_check_mark: Successfully \`\`ADDED\`\` Role to **${oldMember.user.username}**\n\n**User:** <@${oldMember.id}> (ID: ${oldMember.user.id})\n**Role:** \`\`${role.name}\`\` (ID: ${role.id})\n**By:** <@${userID}> (ID: ${userID})`)
- .setTimestamp()
- .setFooter(userTag, userAvatar)
- logChannel.send(roleAdded);
- }
- if(oldMember.roles.size > newMember.roles.size) {
- let role = oldMember.roles.filter(r => !newMember.roles.has(r.id)).first();
- if(!log[oldMember.guild.id]) log[oldMember.guild.id] = {
- onoff: 'Off'
- }
- if(log[oldMember, newMember.guild.id].onoff === 'Off') return;
- let roleRemoved = new Discord.RichEmbed()
- .setTitle('**[REMOVED ROLE FROM MEMBER]**')
- .setThumbnail(oldMember.guild.iconURL)
- .setColor('RED')
- .setDescription(`**\n**:negative_squared_cross_mark: Successfully \`\`REMOVED\`\` Role from **${oldMember.user.username}**\n\n**User:** <@${oldMember.user.id}> (ID: ${oldMember.id})\n**Role:** \`\`${role.name}\`\` (ID: ${role.id})\n**By:** <@${userID}> (ID: ${userID})`)
- .setTimestamp()
- .setFooter(userTag, userAvatar)
- logChannel.send(roleRemoved);
- }
- })
- if(oldMember.guild.owner.id !== newMember.guild.owner.id) {
- if(!log[oldMember.guild.id]) log[oldMember.guild.id] = {
- onoff: 'Off'
- }
- if(log[oldMember, newMember.guild.id].onoff === 'Off') return;
- let newOwner = new Discord.RichEmbed()
- .setTitle('**[UPDATE GUILD OWNER]**')
- .setThumbnail(oldMember.guild.iconURL)
- .setColor('GREEN')
- .setDescription(`**\n**:white_check_mark: Successfully \`\`TRANSFER\`\` The Owner Ship.\n\n**Old Owner:** <@${oldMember.user.id}> (ID: ${oldMember.user.id})\n**New Owner:** <@${newMember.user.id}> (ID: ${newMember.user.id})`)
- .setTimestamp()
- .setFooter(oldMember.guild.name, oldMember.guild.iconURL)
- logChannel.send(newOwner);
- }
- });
- client.on('voiceStateUpdate', (voiceOld, voiceNew) => {
- if(!voiceOld.guild.member(client.user).hasPermission('EMBED_LINKS')) return;
- if(!voiceOld.guild.member(client.user).hasPermission('VIEW_AUDIT_LOG')) return;
- if(!log[voiceOld.guild.id]) log[voiceOld.guild.id] = {
- onoff: 'Off'
- }
- if(log[voiceOld, voiceOld.guild.id].onoff === 'Off') return;
- var logChannel = voiceOld.guild.channels.find(c => c.name === `${log[voiceOld, voiceNew.guild.id].channel}`);
- if(!logChannel) return;
- voiceOld.guild.fetchAuditLogs().then(logs => {
- var userID = logs.entries.first().executor.id;
- var userTag = logs.entries.first().executor.tag;
- var userAvatar = logs.entries.first().executor.avatarURL;
- if(voiceOld.serverMute === false && voiceNew.serverMute === true) {
- let serverMutev = new Discord.RichEmbed()
- .setTitle('**[VOICE MUTE]**')
- .setThumbnail('https://images-ext-1.discordapp.net/external/pWQaw076OHwVIFZyeFoLXvweo0T_fDz6U5C9RBlw_fQ/https/cdn.pg.sa/UosmjqDNgS.png')
- .setColor('RED')
- .setDescription(`**User:** ${voiceOld} (ID: ${voiceOld.id})\n**By:** <@${userID}> (ID: ${userID})\n**Channel:** \`\`${voiceOld.voiceChannel.name}\`\` (ID: ${voiceOld.voiceChannel.id})`)
- .setTimestamp()
- .setFooter(userTag, userAvatar)
- logChannel.send(serverMutev);
- }
- if(voiceOld.serverMute === true && voiceNew.serverMute === false) {
- if(!log[voiceOld.guild.id]) log[voiceOld.guild.id] = {
- onoff: 'Off'
- }
- if(log[voiceOld, voiceOld.guild.id].onoff === 'Off') return;
- let serverUnmutev = new Discord.RichEmbed()
- .setTitle('**[VOICE UNMUTE]**')
- .setThumbnail('https://images-ext-1.discordapp.net/external/u2JNOTOc1IVJGEb1uCKRdQHXIj5-r8aHa3tSap6SjqM/https/cdn.pg.sa/Iy4t8H4T7n.png')
- .setColor('GREEN')
- .setDescription(`**User:** ${voiceOld} (ID: ${voiceOld.id})\n**By:** <@${userID}> (ID: ${userID})\n**Channel:** \`\`${voiceOld.voiceChannel.name}\`\` (ID: ${voiceOld.voiceChannel.id})`)
- .setTimestamp()
- .setFooter(userTag, userAvatar)
- logChannel.send(serverUnmutev);
- }
- if(voiceOld.serverDeaf === false && voiceNew.serverDeaf === true) {
- if(!log[voiceOld.guild.id]) log[voiceOld.guild.id] = {
- onoff: 'Off'
- }
- if(log[voiceOld, voiceOld.guild.id].onoff === 'Off') return;
- let serverDeafv = new Discord.RichEmbed()
- .setTitle('**[VOICE DEAF]**')
- .setThumbnail('https://images-ext-1.discordapp.net/external/7ENt2ldbD-3L3wRoDBhKHb9FfImkjFxYR6DbLYRjhjA/https/cdn.pg.sa/auWd5b95AV.png')
- .setColor('RED')
- .setDescription(`**User:** ${voiceOld} (ID: ${voiceOld.id})\n**By:** <@${userID}> (ID: ${userID})\n**Channel:** \`\`${voiceOld.voiceChannel.name}\`\` (ID: ${voiceOld.voiceChannel.id})`)
- .setTimestamp()
- .setFooter(userTag, userAvatar)
- logChannel.send(serverDeafv);
- }
- if(voiceOld.serverDeaf === true && voiceNew.serverDeaf === false) {
- if(!log[voiceOld.guild.id]) log[voiceOld.guild.id] = {
- onoff: 'Off'
- }
- if(log[voiceOld, voiceOld.guild.id].onoff === 'Off') return;
- let serverUndeafv = new Discord.RichEmbed()
- .setTitle('**[VOICE UNDEAF]**')
- .setThumbnail('https://images-ext-2.discordapp.net/external/s_abcfAlNdxl3uYVXnA2evSKBTpU6Ou3oimkejx3fiQ/https/cdn.pg.sa/i7fC8qnbRF.png')
- .setColor('GREEN')
- .setDescription(`**User:** ${voiceOld} (ID: ${voiceOld.id})\n**By:** <@${userID}> (ID: ${userID})\n**Channel:** \`\`${voiceOld.voiceChannel.name}\`\` (ID: ${voiceOld.voiceChannel.id})`)
- .setTimestamp()
- .setFooter(userTag, userAvatar)
- logChannel.send(serverUndeafv);
- }
- })
- if(voiceOld.voiceChannelID !== voiceNew.voiceChannelID && voiceNew.voiceChannel && voiceOld.voiceChannel != null) {
- if(!log[voiceOld.guild.id]) log[voiceOld.guild.id] = {
- onoff: 'Off'
- }
- if(log[voiceOld, voiceOld.guild.id].onoff === 'Off') return;
- let voiceLeave = new Discord.RichEmbed()
- .setTitle('**[CHANGED VOICE ROOM]**')
- .setColor('GREEN')
- .setThumbnail(voiceOld.user.avatarURL)
- .setDescription(`**\n**:repeat: Successfully \`\`CHANGED\`\` The Voice Channel.\n\n**From:** \`\`${voiceOld.voiceChannel.name}\`\` (ID: ${voiceOld.voiceChannelID})\n**To:** \`\`${voiceNew.voiceChannel.name}\`\` (ID: ${voiceNew.voiceChannelID})\n**User:** ${voiceOld} (ID: ${voiceOld.id})`)
- .setTimestamp()
- .setFooter(voiceOld.user.tag, voiceOld.user.avatarURL)
- logChannel.send(voiceLeave);
- }
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement