Advertisement
Guest User

Index.js

a guest
Apr 21st, 2019
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.85 KB | None | 0 0
  1. const discord = require("discord.js");
  2. const client = new discord.Client();
  3. const fs = require("fs");
  4. const botConfig = require("./botConfig.json")
  5.  
  6. const active = new Map();
  7.  
  8. var automod = ["https://discord.gg/"];
  9.  
  10. client.on("message", message => {
  11.  
  12. if (message.author.bot) return;
  13. if (message.channel.type === "dm") return;
  14.  
  15. if (message.channel.id === "557621437859495937") {
  16. message.react("✅")
  17. }
  18.  
  19. for(var i = 0; i < automod.length; i++) {
  20. if(message.content.includes(automod[i])) {
  21.  
  22. if(message.member.hasPermissions("KICK_MEMBERS")) return;
  23.  
  24. const inviteEmbed = new discord.RichEmbed()
  25. .setThumbnail("https://cdn.discordapp.com/attachments/558241870057308171/558242613333983234/Dynamic.png")
  26. .setColor("#FF0000")
  27. .setTitle(`${message.author.username} heeft een invite gestuurd!`)
  28. .addField("Channel:", message.channel)
  29. .addField("Bericht:", message)
  30.  
  31. var modChannel = message.guild.channels.find(`name`, "speler-informatie");
  32. message.delete()
  33. message.channel.send(`Geen invites ${message.author}!`);
  34. modChannel.send(inviteEmbed);
  35.  
  36. }
  37. }
  38.  
  39. var ops = {
  40.  
  41. active: active
  42.  
  43. }
  44.  
  45. if(message.content.indexOf(botConfig.prefix) !== 0) return;
  46.  
  47. const args = message.content.slice(botConfig.prefix.length).trim().split(/ +/g);
  48. const command = args.shift().toLowerCase();
  49.  
  50. try {
  51. let commandFile = require(`./commands/${command}.js`);
  52. commandFile.run(client, message, args, ops);
  53. } catch (err) {
  54. console.error(err);
  55. }
  56. });
  57.  
  58. client.on('guildMemberAdd', member => {
  59.  
  60. let welcomeEmbed = new discord.RichEmbed()
  61. .setColor("#00FA3A")
  62. .setThumbnail("https://cdn.discordapp.com/attachments/558241870057308171/558242613333983234/Dynamic.png")
  63. .addField(`Hey ${member.user.username}, Welcome to the Dynamic Discord! :tada:`, `Welcome to the server ${member.user.username}. Hopefully you are enjoying yourself`)
  64. .setFooter("Copyrighted © Dynamic eSports 2019")
  65.  
  66. if(member.guild.id === '557299419280703490') {
  67. client.channels.get('568849004461293609').send(welcomeEmbed)
  68.  
  69. member.addRole("557635051706122259");
  70. member.addRole("565235803438186498");
  71.  
  72. return;
  73.  
  74. }
  75. });
  76.  
  77. client.on('guildMemberRemove', member => {
  78.  
  79.  
  80. let welcomeEmbed = new discord.RichEmbed()
  81. .setColor("#FF0000")
  82. .setThumbnail("https://cdn.discordapp.com/attachments/558241870057308171/558242613333983234/Dynamic.png")
  83. .addField(`${member.user.username} heeft de server verlaten :cry:`, "Hopelijk heb je het naar je zin gehad")
  84. .setFooter("Copyrighted © Dynamic eSports 2019")
  85.  
  86. if(member.guild.id === '557299419280703490') {
  87. client.channels.get('568849004461293609').send(welcomeEmbed)
  88. return;
  89. }
  90. });
  91.  
  92. client.on("ready", () => {
  93. console.log("De bot is opgestart")
  94.  
  95. client.user.setActivity("!help", {type: "PLAYING"});
  96.  
  97. });
  98.  
  99. const events = {
  100. MESSAGE_REACTION_ADD: 'messageReactionAdd'
  101. };
  102.  
  103. client.on('raw', async event => {
  104.  
  105. if (!events.hasOwnProperty(event.t)) return;
  106.  
  107. const { d: data } = event;
  108. const user = client.users.get(data.user_id);
  109. const channel = client.channels.get(data.channel_id) || await user.createDM();
  110.  
  111. if (channel.id !== "557621437859495937") return;
  112.  
  113. if (channel.messages.has(data.message_id)) return;
  114.  
  115. const message = await channel.fetchMessage(data.message_id);
  116.  
  117. const emojiKey = (data.emoji.id) ? `${data.emoji.name}:${data.emoji.id}` : data.emoji.name;
  118. const reaction = message.reactions.get(emojiKey);
  119.  
  120. client.emit(events[event.t], reaction, user);
  121. });
  122.  
  123. client.on('messageReactionAdd', (reaction, user) => {
  124.  
  125. user.send(`ℹ We hebben de volgende info van je nodig voordat we je kunnen tryouten: \n\n**-Epic Name \n-Platform \n-Leeftijd** \n\n __***LET OP:***__ Antwoord in EEN bericht op deze vragen! (ivm bot system)`);
  126.  
  127. });
  128.  
  129.  
  130. client.login(botConfig.token);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement