nyx/commands/Giveaway/giveaway.js

46 lines
1.7 KiB
JavaScript
Raw Normal View History

2021-06-12 12:53:51 +02:00
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) => {
2021-06-12 12:53:51 +02:00
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),
2021-06-12 12:53:51 +02:00
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!",
2021-06-24 09:53:19 +02:00
embedFooter: `Made by ${client.author}`,
2021-06-12 12:53:51 +02:00
hostedBy: "Hosted by: {user}",
winners: "Winner(s)",
messageURL: "",
endedAt: "Ends at",
units: {
seconds: "seconds",
minutes: "minutes",
hours: "hours",
days: "days",
pluralS: false,
},
},
});
2021-09-06 12:38:25 +02:00
message.reply(`Giveaway is started in ${channel}`);
2021-06-12 12:53:51 +02:00
},
};