Androz2091 / discord-giveaways

🎉 Complete framework to facilitate the creation of giveaways using discord.js
https://discord-giveaways.js.org
MIT License
334 stars 127 forks source link

The manager is not ready yet. #251

Closed Dragonizedpizza closed 3 years ago

Dragonizedpizza commented 3 years ago

const { MessageEmbed } = require('discord.js');

module.exports = {
    name: "messageUpdate",
    run: async (oldMessage, newMessage, client) => {

  if (newMessage.webhookID) return;
  if (
    newMessage.member && 
    newMessage.id === newMessage.member.lastMessageID &&
    !oldMessage.command
  ) {
    client.emit('message', newMessage);
  }
}
}```
if I edit a message and trigger this event and try to host a giveaway, why do I get that error?
Nico105 commented 3 years ago

Ahm does it really only happen after you edited some message? Because if the manager is not ready then it is because he still checks giveaways/the provided client is invalid/the giveaway.json file does not contain an array So that should have nothing to do with that "messageUpdate" code of yours or... = it should throw the error whenever you try starting a gaw no matter what you did before

Dragonizedpizza commented 3 years ago

{ "stack": "TypeError: guild.member is not a function at Giveaway.checkWinnerEntry (/home/container/node_modules/discord-giveaways/src/Giveaway.js:302:30) at Giveaway.roll (/home/container/node_modules/discord-giveaways/src/Giveaway.js:333:45) at runMicrotasks () at processTicksAndRejections (internal/process/task_queues.js:93:5) at async /home/container/node_modules/discord-giveaways/src/Giveaway.js:400:29" } Just started using master branch of discord.js, I see the problem

Nico105 commented 3 years ago

Yeah they removed the getter in master, I will adjust it when I have time

Dragonizedpizza commented 3 years ago

@Nico105 the fix is pretty simple, just guild.members.cache.get(user.id)

Dragonizedpizza commented 3 years ago

could you like tell me when you adjust it though so I can reinstall discord-giveaways

Nico105 commented 3 years ago

In about 10h

Dragonizedpizza commented 3 years ago

yeah nvm just changed it myself kekw