Sir_Spaceboi

giveaway not working

Feb 6th, 2021
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. module.exports = {
  2.   name: 'giveaway',
  3.   description: 'Giveaway things.',
  4.   execute(message, args, bot) {
  5.         const ms = require('ms');  
  6.  
  7.         let channel = message.mentions.channels.first();
  8.  
  9.         if (!channel) return message.channel.send('Please provide a channel');
  10.  
  11.         let giveawayDuration = args[1];
  12.  
  13.         if (!giveawayDuration || isNaN(ms(giveawayDuration))) return message.channel.send('Pleae provide a valid duration');
  14.  
  15.         let giveawayWinners = args[2];
  16.  
  17.         if (isNaN(giveawayWinners) || (parseInt(giveawayWinners) <= 0)) return message.channel.send('Please provide a valid number of winners!');
  18.  
  19.         let giveawayPrize = args.slice(3).join(" ");
  20.  
  21.         if (!giveawayPrize) return message.channel.send('Ok then, I\'ll give away nothing');
  22.  
  23.         bot.giveawaysManager.start(channel, {
  24.             time: ms(giveawayDuration),
  25.             prize: giveawayPrize,
  26.             winnerCount: giveawayWinners,
  27.             hostedBy: bot.config.hostedBy ? message.author : null,
  28.  
  29.             messages: {
  30.                 giveaway: (bot.config.everyoneMention ? "@everyone\n\n" : "") + "GIVEAWAY",
  31.                 giveawayEned: (bot.config.everyoneMention ? "@everyone\n\n" : "") + "GIVEAWAY ENDED",
  32.                 timeRemaining: "Time remaining: **{duration}**",
  33.                 inviteToParticipate: "React with 🎉 to enter",
  34.                 winMessage: "Congrats {winners}, you won **{prize}**",
  35.                 embedFooter: "Giveaway time!",
  36.                 noWinner: "Couldn't determine a winner",
  37.                 hostedBy: "Hosted by {user}",
  38.                 winners: "winner(s)",
  39.                 endedAt: "Ends at",
  40.                 units: {
  41.                     seconds: "seconds",
  42.                     minutes: "minutes",
  43.                     hours: "hours",
  44.                     days: "days",
  45.                     pluralS: false
  46.                 }
  47.             }
  48.         })
  49.  
  50.         message.channel.send(`Giveaway starting in ${channel}`);
  51.   }
  52. }
Advertisement
Add Comment
Please, Sign In to add comment