Advertisement
Zaayd

Voice Status Update ({type:"event",version:"discord.js v12"})

Aug 17th, 2021
984
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. Coded By : Me , 9 9 9 <Eùros/>#0204
  3. ID : 678517905150836757
  4. Error? : https://discord.gg/mmD3bxRK4Z
  5. */
  6. const Discord = require("discord.js");
  7. const colors = require("colors");
  8. let db = require("quick.db")
  9. module.exports = {
  10.   name:"voiceStateUpdate",
  11.   async execute(oldVoice , newVoice , client) {
  12.     let loggerChannelID = "861888019324731402";
  13.     let loogerChannel = newVoice.guild.channels.cache.get(loggerChannelID);
  14.     let user = await client.users.cache.get(newVoice.id)
  15.     let log = await newVoice.guild.fetchAuditLogs({
  16.       type : "DISCONNECT_MEMBER"
  17.     })
  18.     let log1 = await newVoice.guild.fetchAuditLogs({
  19.       type : "MOVE_MEMBER"
  20.     })
  21.     let log2 = await newVoice.guild.fetchAuditLogs({
  22.       type : "UPDATE_MEMBER"
  23.     })
  24.     let admine3;
  25.     let executor3 = log2.entries.first().executor;
  26.     if(executor3.id === user.id){
  27.       admine3 = "He / She self"
  28.     } else {
  29.       admine3 = executor
  30.     }
  31.     let admine2;
  32.     let executor2 = log1.entries.first().executor;
  33.     if(executor2.id === user.id){
  34.       admine2 = "He / She self"
  35.     } else {
  36.       admine2 = executor
  37.     }
  38.     let admin
  39.     let executor = log.entries.first().executor;
  40.     if(executor.id === user.id){
  41.       admin = "He / She self"
  42.     } else {
  43.       admin = executor
  44.     }
  45.     let check = (bool) => bool ? "`✅`" : "`❌`";
  46.     if(!oldVoice.channel && newVoice.channel){
  47.       let ChangeChannel = new Discord.MessageEmbed()
  48.       .setAuthor(user.tag,user.avatarURL({dynamic:true}))
  49.       .setDescription(`**${user} joined voice channel \`${newVoice.channel.name}\`.**`)
  50.       .addField("**User Info**",[
  51.         `**ID : ${user.id}**`,
  52.         `**self Mute : **${check(newVoice.selfMute)}`,
  53.         `**Self Deaf : **${check(newVoice.selfDeaf)}`,
  54.         `**Server Mute : **${check(newVoice.serverMute)}`,
  55.         `**Server Deaf : **${check(newVoice.serverDeaf)}`,
  56.         `**Self Video : **${check(newVoice.selfVideo)}`,
  57.         `**Streaming : **${check(newVoice.streaming)}`,
  58.       ])
  59.       .setFooter(newVoice.guild.name,newVoice.guild.iconURL({dynamic:true}))
  60.       .setTimestamp()
  61.       loogerChannel.send(ChangeChannel)
  62.     } else if(!newVoice.channel && oldVoice.channel){
  63.       let ChangeChannel = new Discord.MessageEmbed()
  64.       .setAuthor(user.tag,user.avatarURL({dynamic:true}))
  65.       .setDescription(`**${user} left voice channel \`${oldVoice.channel.name}\`\nBy : ${admin}.**`)
  66.       .setFooter(oldVoice.guild.name,oldVoice.guild.iconURL({dynamic:true}))
  67.       .setTimestamp()
  68.       loogerChannel.send(ChangeChannel)
  69.     } else if(oldVoice.channel != newVoice.channel){
  70.       let ChangeChannel = new Discord.MessageEmbed()
  71.       .setAuthor(user.tag,user.avatarURL({dynamic:true}))
  72.       .setDescription(`**${user} switched voice channel from \`${oldVoice.channel.name}\` to \`${newVoice.channel.name}\`\nBy : ${admine2}.**`)
  73.       .setFooter(newVoice.guild.name,newVoice.guild.iconURL({dynamic:true}))
  74.       .setTimestamp()
  75.       loogerChannel.send(ChangeChannel)
  76.     } else if(oldVoice.serverMute != newVoice.serverMute){
  77.       let ServerMute = new Discord.MessageEmbed()
  78.       .setAuthor(user.tag,user.avatarURL({dynamic:true}))
  79.       .addField(`**BEFOR**`,`${check(oldVoice.serverMute)} : Server Mute`)
  80.       .addField(`**AFTER**`,`${check(newVoice.serverMute)} : Server Mute`)
  81.       .addField(`**By : **`,`**${admine3}**`)
  82.       .setFooter(newVoice.guild.name,newVoice.guild.iconURL({dynamic:true}))
  83.       .setTimestamp()
  84.       loogerChannel.send(ServerMute)
  85.     } else if(oldVoice.serverDeaf != newVoice.serverDeaf){
  86.       let ServerDeaf = new Discord.MessageEmbed()
  87.       .setAuthor(user.tag,user.avatarURL({dynamic:true}))
  88.       .addField(`**BEFOR**`,`${check(oldVoice.serverDeaf)} : Server Deaf`)
  89.       .addField(`**AFTER**`,`${check(newVoice.serverDeaf)} : Server Deaf`)
  90.       .addField(`**By : **`,`**${admine3}**`)
  91.       .setFooter(newVoice.guild.name,newVoice.guild.iconURL({dynamic:true}))
  92.       .setTimestamp()
  93.       loogerChannel.send(ServerDeaf)
  94.     } else if(oldVoice.selfMute != newVoice.selfMute){
  95.       let selfMute = new Discord.MessageEmbed()
  96.       .setAuthor(user.tag,user.avatarURL({dynamic:true}))
  97.       .addField(`**BEFOR**`,`${check(oldVoice.selfMute)} : Self Mute`)
  98.       .addField(`**AFTER**`,`${check(newVoice.selfMute)} : Self Mute`)
  99.       .setFooter(newVoice.guild.name,newVoice.guild.iconURL({dynamic:true}))
  100.       .setTimestamp()
  101.       loogerChannel.send(selfMute)
  102.     } else if(oldVoice.selfDeaf != newVoice.selfDeaf){
  103.       let selfDeaf = new Discord.MessageEmbed()
  104.       .setAuthor(user.tag,user.avatarURL({dynamic:true}))
  105.       .addField(`**BEFOR**`,`${check(oldVoice.selfDeaf)} : Self Deaf`)
  106.       .addField(`**AFTER**`,`${check(newVoice.selfDeaf)} : Self Deaf`)
  107.       .setFooter(newVoice.guild.name,newVoice.guild.iconURL({dynamic:true}))
  108.       .setTimestamp()
  109.       loogerChannel.send(selfDeaf)
  110.     } else if(oldVoice.selfVideo != newVoice.selfVideo){
  111.       let ServerDeaf = new Discord.MessageEmbed()
  112.       .setAuthor(user.tag,user.avatarURL({dynamic:true}))
  113.       .addField(`**BEFOR**`,`${check(oldVoice.selfVideo)} : Self Video`)
  114.       .addField(`**AFTER**`,`${check(newVoice.selfVideo)} : Self Video`)
  115.       .setFooter(newVoice.guild.name,newVoice.guild.iconURL({dynamic:true}))
  116.       .setTimestamp()
  117.       loogerChannel.send(ServerDeaf)
  118.     } else if(oldVoice.streaming != newVoice.streaming){
  119.       let ServerDeaf = new Discord.MessageEmbed()
  120.       .setAuthor(user.tag,user.avatarURL({dynamic:true}))
  121.       .addField(`**BEFOR**`,`${check(oldVoice.streaming)} : Streaming`)
  122.       .addField(`**AFTER**`,`${check(newVoice.streaming)} : Streaming`)
  123.       .setFooter(newVoice.guild.name,newVoice.guild.iconURL({dynamic:true}))
  124.       .setTimestamp()
  125.       loogerChannel.send(ServerDeaf)
  126.     }
  127.   }
  128. }
  129. /*
  130. Coded By : Me , 9 9 9 <Eùros/>#0204
  131. ID : 678517905150836757
  132. Error? : https://discord.gg/mmD3bxRK4Z
  133. */
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement