Advertisement
DubStepMad

Untitled

Jun 30th, 2023
23
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.42 KB | None | 0 0
  1. module.exports = {
  2. name: Events.GuildMemberAdd,
  3. once: false,
  4. async execute(interaction, client) {
  5. const member = interaction.member ?? interaction.user;
  6. const images = [];
  7.  
  8. fs.readdirSync("./assets/welcomeimages/").forEach((file) => {
  9. let month = moment().month();
  10. if (month === 12) {
  11. if (file.includes("christmas")) {
  12. images.push(
  13. `https://sfmbot.simulator.fm/assets/welcomeimages/${file}`
  14. );
  15. }
  16. } else if (month === 11) {
  17. if (file.includes("halloween")) {
  18. images.push(
  19. `https://sfmbot.simulator.fm/assets/welcomeimages/${file}`
  20. );
  21. }
  22. } else {
  23. images.push(`https://sfmbot.simulator.fm/assets/welcomeimages/${file}`);
  24. }
  25. });
  26. const background = images[Math.floor(Math.random() * images.length)],
  27. avatar = member.displayAvatarURL(),
  28. color = "FFFFFF";
  29.  
  30. let Image = await new noodles_api.welcomebanner()
  31. .setBackground(background)
  32. .setAvatar(avatar)
  33. .setTitle(member.username)
  34. .setSubtitle("Welcome to the server")
  35. .setTextColor(color)
  36. .build();
  37.  
  38. const WImage = new AttachmentBuilder(Image);
  39. client.channels.cache.get("776056599177068560").send(
  40. `${client} Please read the rules found here <#776056599177068561>`,
  41. WImage
  42. );
  43.  
  44. member.roles.add("776056599173267467");
  45. },
  46. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement