Guest User

Spy bot by 0pie#4835

a guest
Aug 22nd, 2019
108
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const Discord = require('discord.js');
  2. const Client = new Discord.Client();
  3. var QG = null;
  4.  
  5. const idQG = 'id_serveur_prive';
  6. const userid = 'ton_id';
  7. const managechannelid = 'id_du_channel_pour_gerer'
  8. const token = 'ton_token';
  9.  
  10. const serveur1 = 'id_du_serveur1';
  11. const serveur1grp = 'id_de_categorie_serveur1';
  12.  
  13. const serveur2 = 'id_du_serveur2';
  14. const serveur2grp = 'id_de_categorie_serveur2';
  15.  
  16. Client.on('ready', function() {
  17. console.log("[Spy ready]");
  18. QG = Client.guilds.get(idQG);
  19. });
  20.  
  21. Client.on('messageDelete', function(message) {
  22. var guild = message.guild;
  23.  
  24. if (message.author.bot === true) {
  25. return;
  26. }
  27.  
  28. const Embed = new Discord.RichEmbed()
  29. .setTitle("Message deleted in #" + message.channel.name)
  30. .setAuthor(message.author.username + "#" + message.author.discriminator)
  31. .setColor("#FF0000")
  32. .setDescription(message.content)
  33. .setThumbnail(message.author.avatarURL);
  34.  
  35. switch (guild.id) {
  36. case serveur1: // Serveur 1
  37. var channel = QG.channels.get(serveur1grp).children.find(chan => chan.name === 'deleted').send(Embed);
  38. break;
  39. case serveur2: // Serveur 2
  40. var channel = QG.channels.get(serveur2grp).children.find(chan => chan.name === 'deleted').send(Embed);;
  41. break;
  42. default:
  43.  
  44. }
  45. });
  46. Client.on('messageUpdate', function(oldMessage, newMessage) {
  47. var guild = oldMessage.guild;
  48. if (newMessage.content == oldMessage.content || newMessage.author.bot === true) {
  49. return;
  50. }
  51.  
  52. try {
  53. const Embed = new Discord.RichEmbed()
  54. .setTitle("Message edited in #" + newMessage.channel.name)
  55. .setAuthor(newMessage.author.username + "#" + newMessage.author.discriminator)
  56. .setColor("#3399FF")
  57. .addField("Old message", oldMessage.content, true)
  58. .addField("New message", newMessage.content, true)
  59. .setThumbnail(newMessage.author.avatarURL);
  60.  
  61. switch (guild.id) {
  62. case serveur1: // Serveur 1
  63. var channel = QG.channels.get(serveur1grp).children.find(chan => chan.name === 'edited').send(Embed);
  64. break;
  65. case serveur2: // Serveur 2
  66. var channel = QG.channels.get(serveur2grp).children.find(chan => chan.name === 'edited').send(Embed);;
  67. break;
  68. default:
  69. break;
  70. }
  71. } catch(e) {
  72.  
  73. }
  74. });
  75. Client.on('voiceStateUpdate', function(oldMember, newMember) {
  76. var guild = oldMember.guild;
  77.  
  78. var Embed = new Discord.RichEmbed()
  79. .setAuthor(newMember.user.username + "#" + newMember.user.discriminator)
  80. .setColor("#20DD20")
  81. .setThumbnail(newMember.user.avatarURL);
  82.  
  83. switch (guild.id) {
  84. case serveur1: // Serveur 1
  85. var Embed = new Discord.RichEmbed()
  86. .setAuthor(newMember.user.username + "#" + newMember.user.discriminator)
  87. .setColor("#20DD20")
  88. .setThumbnail(newMember.user.avatarURL);
  89.  
  90. // Connection / Disconnection
  91. if (oldMember.voiceChannelID == null && newMember.voiceChannelID != null) {
  92. Embed.setTitle("New connection in 🔉 " + Client.channels.get(newMember.voiceChannelID).name);
  93. } else if (oldMember.voiceChannelID != null && newMember.voiceChannelID == null) {
  94. Embed.setTitle("New disconnection in 🔉 " + Client.channels.get(oldMember.voiceChannelID).name);
  95. } else if (oldMember.serverMute == false && newMember.serverMute == true) { // ========================= Server mute / unmute
  96. Embed.setTitle("Server muted in 🔉 " + Client.channels.get(newMember.voiceChannelID).name);
  97. } else if (oldMember.serverMute == true && newMember.serverMute == false) {
  98. Embed.setTitle("Server unmuted in 🔉 " + Client.channels.get(newMember.voiceChannelID).name);
  99. } else if (oldMember.serverDeaf == false && newMember.serverDeaf == true) { // ========================= Server deaf / undeaf
  100. Embed.setTitle("Server deafed in 🔉 " + Client.channels.get(newMember.voiceChannelID).name);
  101. } else if (oldMember.serverDeaf == true && newMember.serverDeaf == false) {
  102. Embed.setTitle("Server undeafed in 🔉 " + Client.channels.get(newMember.voiceChannelID).name);
  103. } else if (oldMember.selfMute == false && newMember.selfMute == true) { // ============================= Self mute / unmute
  104. Embed.setTitle("Self muted in 🔉 " + Client.channels.get(newMember.voiceChannelID).name);
  105. } else if (oldMember.selfMute == true && newMember.selfMute == false) {
  106. Embed.setTitle("Self unmuted in 🔉 " + Client.channels.get(newMember.voiceChannelID).name);
  107. } else if (oldMember.selfDeaf == false && newMember.selfDeaf == true) { // ============================= Self deaf / undeaf
  108. Embed.setTitle("Self deafed in 🔉 " + Client.channels.get(newMember.voiceChannelID).name);
  109. } else if (oldMember.selfDeaf == true && newMember.selfDeaf == false) {
  110. Embed.setTitle("Self undeafed in 🔉 " + Client.channels.get(newMember.voiceChannelID).name);
  111. } else {
  112. return;
  113. }
  114.  
  115. var channel = QG.channels.get(serveur1).children.find(chan => chan.name === 'voice-status').send(Embed);
  116. break;
  117. default:
  118. }
  119. });
  120.  
  121. Client.on('message', function (message) {
  122. if (message.author.id != userid || message.channel.id != managechannelid) {
  123. return;
  124. }
  125.  
  126. var parts = message.content.split(' ');
  127. if (parts[0] == 'clear') {
  128. switch (parts[2]) {
  129. case 'deleted':
  130. QG.channels.get(eval(parts[1])).children.find(chan => chan.name === 'deleted').delete();
  131. QG.createChannel('deleted', {parent: QG.channels.get(eval(parts[1]))});
  132. break;
  133. case 'edited':
  134. QG.channels.get(eval(parts[1])).children.find(chan => chan.name === 'edited').delete();
  135. QG.createChannel('edited', {parent: QG.channels.get(eval(parts[1]))});
  136. break;
  137. case 'voice':
  138. QG.channels.get(eval(parts[1])).children.find(chan => chan.name === 'voice-status').delete();
  139. QG.createChannel('voice-status', {parent: QG.channels.get(eval(parts[1]))});
  140. break;
  141. default:
  142.  
  143. }
  144. }
  145. });
  146.  
  147.  
  148. Client.login(token);
RAW Paste Data