Holana/events/giveaways/giveawayReactionAdded.js
2023-04-29 21:59:08 +12:00

64 lines
No EOL
2.8 KiB
JavaScript

const { EmbedBuilder, ActionRowBuilder, ButtonBuilder, ButtonStyle } = require('discord.js');
module.exports = {
async execute(giveaway, reactor, messageReaction) {
const noice = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setLabel("Invite Me")
.setStyle(ButtonStyle.Link)
.setURL("https://discord.com/api/oauth2/authorize?client_id=726333575091454002&permissions=406881561681&scope=bot%20applications.commands")
.setEmoji('984296691794583582'),
);
let approved = new EmbedBuilder()
.setTimestamp()
.setColor("#2F3136")
.setAuthor({name: "Entry Confirmed!", iconURL: "https://ellie.gcoms.xyz/Ellise.png"})
.setDescription(
`<:DotGreen:1002212464345239643> Your entry to **${giveaway.prize}** on [This Server](https://discord.com/channels/${giveaway.guildId}/${giveaway.channelId}/${giveaway.messageId}) has been approved! \n<:DotGreen:1002212464345239643> Earn extra points by **Voting**. \n<:DotPink:1002212468870877304> Hosted By: ${giveaway.hostedBy}`
)
.setFooter({ text: "©️ Holana", iconURL: ('https://ellie.gcoms.xyz/Ellise.png') })
.setTimestamp()
const lol = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setLabel("Invite Me")
.setStyle(ButtonStyle.Link)
.setURL("https://discord.com/api/oauth2/authorize?client_id=726333575091454002&permissions=406881561681&scope=bot%20applications.commands")
.setEmoji('984296691794583582'),
);
let denied = new EmbedBuilder()
.setTimestamp()
.setColor("#2F3136")
.setAuthor({name: "Entry Denied!", iconURL: "https://ellie.gcoms.xyz/Ellise.png"})
.setDescription(
`<:DotPink:1002212468870877304> Your entry to **${giveaway.prize}** on [This Server](https://discord.com/channels/${giveaway.guildId}/${giveaway.channelId}/${giveaway.messageId}) has been denied! \n<:DotPink:1002212468870877304> Please review the requirements to enter the giveaway properly. \n<:DotPink:1002212468870877304> Hosted By: ${giveaway.hostedBy}`
)
.setFooter({ text: "©️ Holana", iconURL: ('https://ellie.gcoms.xyz/Ellise.png') })
let client = messageReaction.message.client
if (reactor.user.bot) return;
if(giveaway.extraData) {
if (giveaway.extraData.role !== "null" && !reactor.roles.cache.get(giveaway.extraData.role)){
messageReaction.users.remove(reactor.user);
return reactor.send({
embeds: [denied],
components: [lol]
}).catch(e => {})
}
return reactor.send({
embeds: [approved],
components: [noice]
}).catch(e => {})
} else {
return reactor.send({
embeds: [approved]
}).catch(e => {})
}
}
}