nyx/commands/Giveaway/giveaway.js

45 lines
1.7 KiB
JavaScript

module.exports = {
name: "giveaway",
aliases: ["gstart"],
description: "Start a giveaway",
usage: "(Channel) (Time) (Winners(Number)) (Prize)",
UserPerm: "MANAGE_MESSAGES",
run: async (client, message, args, utils) => {
const channel = message.mentions.channels.first();
if (!channel) return client.err(message, "Giveaway", "giveaway", 28);
const duration = args[1];
if (!duration) return client.err(message, "Giveaway", "giveaway", 29);
const winners = parseInt(args[2]);
if (!winners) return client.err(message, "Giveaway", "giveaway", 30);
if (isNaN(winners)) return client.err(message, "Giveaway", "giveaway", 31);
const prize = args.slice(3).join(" ");
if (!prize) return client.err(message, "Giveaway", "giveaway", 32);
client.giveaways.start(channel, {
time: utils.ms(duration),
prize: prize,
winnerCount: winners,
hostedBy: message.author,
messages: {
giveaway: "🎉🎉 **GIVEAWAY** 🎉🎉",
giveawayEnded: "🎉🎉 **GIVEAWAY ENDED** 🎉🎉",
timeRemaining: "Time Remaining **{duration}**!",
inviteToParticipate: "React with 🎉 to enter!",
winMessage: `Congratulations {winners}! You won the **${prize}**!`,
noWinner: "Could not determine a winner!",
embedFooter: `Made by ${client.author}`,
hostedBy: "Hosted by: {user}",
winners: "Winner(s)",
messageURL: "",
endedAt: "Ends at",
units: {
seconds: "seconds",
minutes: "minutes",
hours: "hours",
days: "days",
pluralS: false,
},
},
});
message.reply(`Giveaway is started in ${channel}`);
},
};