-
-
Notifications
You must be signed in to change notification settings - Fork 16
/
index.test.js
71 lines (65 loc) · 3.01 KB
/
index.test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
/* eslint-disable no-inline-comments */
/* eslint-disable no-unused-vars */
// Make sure you use `npm run test` when testing the package!
const defaultGiveawayMessages = {
dmWinner: true,
dmHost: true,
giveaway: '🎉🎉 **GIVEAWAY!** 🎉🎉',
giveawayDescription: '🎁 Prize: **{prize}**\n🎊 Hosted by: {hostedBy}\n⏲️ Winner(s): `{winners}`\n\nRequirements: {requirements}',
endedGiveawayDescription : '🎁 Prize: **{prize}**\n🎊 Hosted by: {hostedBy}\n⏲️ Winner(s): {winners}',
giveawayFooterImage: 'https://cdn.discordapp.com/emojis/843076397345144863.png',
winMessage: 'Congrats {winners}! you won `{prize}`!! Total `{totalParticipants}` members participated and your winning percentage was `{winPercentage}%`',
rerolledMessage: 'Rerolled! {winner} is the new winner of the giveaway!', // only {winner} placeholder
toParticipate: '**Click the Enter button to enter the giveaway!**',
newParticipant: 'You have successfully entered for this giveaway! your win percentage is `{winPercentage}%` among `{totalParticipants}` other participants', // no placeholders | ephemeral
alreadyParticipated: 'you already entered this giveaway!', // no placeholders | ephemeral
noParticipants: 'There are not enough people in the giveaway!', // no placeholders
noRole: 'You do not have the required role(s)\n{requiredRoles}\n for the giveaway!', // only {requiredRoles} | ephemeral
dmMessage: 'You have won a giveaway in **{guildName}**!\nPrize: [{prize}]({giveawayURL})',
dmMessageHost: 'Your giveaway in **{guildName}** has ended!\nPrize: [{prize}]({giveawayURL})',
noWinner: 'Not enough people participated in this giveaway.', // no {winner} placerholder
alreadyEnded: 'The giveaway has already ended!', // no {winner} placeholder
dropWin: '{winner} Won The Drop!!',
};
require('dotenv').config();
const Nuggies = require('./src/index.js');
const Discord = require('discord.js');
const bot = new Discord.Client({ intents: 32767 });
// require('discord-buttons')(bot);
bot.login(process.env.token);
Nuggies.handleInteractions(bot);
Nuggies.Messages(bot, {
giveawayOptions: defaultGiveawayMessages,
});
Nuggies.connect(process.env.mongo);
bot.on('messageCreate', async (message) => {
if (message.author.bot || message.channel.type === 'dm') return;
const prefix = '...';
if (!message.content.startsWith(prefix)) return;
// Args system
const messageArray = message.content.split(' ');
const cmd = messageArray[0].slice(prefix.length);
const args = messageArray.slice(1);
if (!cmd) return;
Nuggies.giveaways.startAgain(bot);
if (cmd.toLowerCase() === 'test') {
Nuggies.giveaways.create(bot, {
prize: 'test',
host: message.author.id,
winners: 1,
endAfter: '30s',
requirements: {
enabled: true,
amariweekly: '1',
amarilevel: '100',
key: '754a65c02c176511a5577711.7e61ad.4d1c0a710b5add7b8e2b21da161',
},
channelID: message.channel.id,
});
}
else if (cmd.toLowerCase() == 'die') {
await message.channel.send('ok');
process.exit();
}
});
bot.on('ready', () => console.log('i am online hahahahahahaha'));