Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

144
Views
TypeError: Cannot read properties of undefined (reading 'start')

Giveaway.js

I am getting this error, and I don't know how to fix it, but tutorials use the same thing and don't get this error.

Cannot read properties of undefined (reading 'start')

My code:

case 'start': {
  const gchannel = options.getChannel('channel') || interaction.channel;
  const duration = options.getString('duration');
  const winnerCount = options.getInteger('winners');
  const prize = options.getString('prize');

  client.giveawaysManager
    .start(gchannel, {
      duration: ms(duration),
      winnerCount,
      prize,
      messages: {
        giveaway: '๐ŸŽ‰ **GIVEAWAY STARTED**๐ŸŽ‰',
        giveawayEnded: '๐ŸŽŠ **GIVEAWAY ENDED** ๐ŸŽŠ',
        winMessage: 'Congratulations, {winners}! You won **{this.prize}**!',
      },
    })
    .then(async () => {
      successembed.setDescription('giveaway successfully started.');
      wait(4000);
      interaction.reply({ embeds: [successembed], ephemeral: true });
    })
    .catch((err) => {
      errorembed.setDescription(`An error has occured \n\`${err}\``);
      wait(4000);
      interaction.reply({ embeds: [errorembed], ephemeral: true });
    });
}

The error is in:

client.giveawaysManager.start(gchannel, {
  duration: ms(duration),
  winnerCount,
  prize,
  messages: {
    giveaway: '๐ŸŽ‰ **GIVEAWAY STARTED**๐ŸŽ‰',
    giveawayEnded: '๐ŸŽŠ **GIVEAWAY ENDED** ๐ŸŽŠ',
    winMessage: 'Congratulations, {winners}! You won **{this.prize}**!',
  },
})
about 4 years ago ยท Juan Pablo Isaza
1 answers
Answer question

0

It is not client.giveawaysManager, it needs to be constructed by itself:

manager= new GiveawaysManager(client, options(opt), init(opt));

And then it is called this way:

manager.start(gchannel, {
  duration: ms(duration),
  winnerCount,
  prize,
  messages: {
    giveaway: '๐ŸŽ‰ **GIVEAWAY STARTED**๐ŸŽ‰',
    giveawayEnded: '๐ŸŽŠ **GIVEAWAY ENDED** ๐ŸŽŠ',
    winMessage: 'Congratulations, {winners}! You won **{this.prize}**!',
  },
})

DOC: https://discord-giveaways.js.org/GiveawaysManager.html

about 4 years ago ยท Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
ยฉ 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!