Advertisement
Guest User

Untitled

a guest
Mar 25th, 2019
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.81 KB | None | 0 0
  1. const { Client, RichEmbed, NodeUpos } = require('discord.js');
  2. const schedule = require('node-schedule');
  3. const client = new Client();
  4.  
  5. client.on('ready', () => {
  6. console.log(`Logged in as ${client.user.tag}!`);
  7.  
  8. // Vier uur, bier uur
  9. // const date = new Date(2019, 2, 25, 23, 41, 0);
  10. const date = {hour: 16, minute: 0, dayOfWeek: 5};
  11. schedule.scheduleJob(date, function() {
  12. const channel = client.channels.get("266542205563305984");
  13. // Do nothing if the channel wasn't found on this server
  14. if (!channel) return;
  15. // Send the message, mentioning the member
  16. channel.send('VIER UUR, BIER UUR! @everyone');
  17. });
  18. });
  19.  
  20. // Bier halen functie
  21. client.on('message', msg => {
  22. if (msg.content === 'wie moet er bier halen?') {
  23.  
  24. // Get members & remove bots
  25. let members = Array.from(msg.member.guild.members);
  26. members = members.filter(function (user) {
  27. return !user[1].user.bot;
  28. });
  29.  
  30. // Send dm to the lucky one.
  31. const chosenUser = members[Math.floor(Math.random() * members.length)];
  32. client.users.get(chosenUser[0]).send("BIER HALEN!").then(function () {
  33. console.log('Send!');
  34. });
  35.  
  36. // Reply to msg
  37. msg.reply(chosenUser[1].user.username + ' is de lul!');
  38. }
  39. });
  40.  
  41. // Create an event listener for new guild members
  42. client.on('guildMemberAdd', member => {
  43. // Send the message to a designated channel on a server:
  44. const channel = member.guild.channels.find(ch => ch.name === 'chat');
  45. // Do nothing if the channel wasn't found on this server
  46. if (!channel) return;
  47. // Send the message, mentioning the member
  48. channel.send(`Ewa fakka ${member}?`);
  49. });
  50.  
  51. client.login('MzEwNTQwMzA5ODQ0OTgzODA4.D0RKdw.Le0zSvpZpTlfNOI1BA1mPt26MP8');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement