Updated core files

This commit is contained in:
EmotionChild 2022-12-02 21:53:58 +13:00
parent f0db6ce4c0
commit 099c8edeed
No known key found for this signature in database
GPG key ID: 15EBDFF858B9A65A
3 changed files with 2249 additions and 58 deletions

View file

@ -1,23 +1,21 @@
process.title = 'Giveaway Child'; const fs = require("fs");
const fs = require('fs'); const Discord = require("discord.js");
const Discord = require('discord.js');
const client = new Discord.Client({ const client = new Discord.Client({
intents: [ intents: [
Discord.Intents.FLAGS.GUILDS, Discord.GatewayIntentBits.Guilds,
Discord.Intents.FLAGS.GUILD_MEMBERS, Discord.GatewayIntentBits.GuildMembers,
Discord.Intents.FLAGS.GUILD_MESSAGE_REACTIONS Discord.GatewayIntentBits.GuildMessageReactions,
] ],
}); });
const config = require('./config.json'); const config = require("./config.json");
client.config = config; client.config = config;
const synchronizeSlashCommands = require('discord-sync-commands'); const synchronizeSlashCommands = require("discord-sync-commands");
// Init discord giveaways // Init discord giveaways
const { GiveawaysManager } = require('discord-giveaways'); const { GiveawaysManager } = require("discord-giveaways");
client.giveawaysManager = new GiveawaysManager(client, { client.giveawaysManager = new GiveawaysManager(client, {
storage: "./giveaways.json", storage: "./giveaways.json",
default: { default: {
@ -26,24 +24,38 @@ client.giveawaysManager = new GiveawaysManager(client, {
reaction: "🎉", reaction: "🎉",
lastChance: { lastChance: {
enabled: true, enabled: true,
content: '⚠️ **LAST CHANCE TO ENTER !** ⚠️', content: "⚠️ **LAST CHANCE TO ENTER !** ⚠️",
threshold: 5000, threshold: 10000,
embedColor: '#FF0000' embedColor: "#FF0000",
} },
} },
}); });
// We now have a client.giveawaysManager property to manage our giveaways! // We not have a client.giveaways property to manage our giveaways
client.giveawaysManager.on("giveawayReactionAdded", (giveaway, member, reaction) => { client.giveawaysManager.on(
console.log(`${member.user.tag} entered giveaway #${giveaway.messageId} (${reaction.emoji.name})`); "giveawayReactionAdded",
}); (giveaway, member, reaction) => {
console.log(
`${member.user.tag} entered giveaway #${giveaway.messageId} (${reaction.emoji.name})`
);
}
);
client.giveawaysManager.on("giveawayReactionRemoved", (giveaway, member, reaction) => { client.giveawaysManager.on(
console.log(`${member.user.tag} unreact to giveaway #${giveaway.messageId} (${reaction.emoji.name})`); "giveawayReactionRemoved",
}); (giveaway, member, reaction) => {
console.log(
`${member.user.tag} unreact to giveaway #${giveaway.messageId} (${reaction.emoji.name})`
);
}
);
client.giveawaysManager.on("giveawayEnded", (giveaway, winners) => { client.giveawaysManager.on("giveawayEnded", (giveaway, winners) => {
console.log(`Giveaway #${giveaway.messageId} ended! Winners: ${winners.map((member) => member.user.username).join(', ')}`); console.log(
`Giveaway #${giveaway.messageId} ended! Winners: ${winners
.map((member) => member.user.username)
.join(", ")}`
);
}); });
/* Load all commands */ /* Load all commands */
@ -55,18 +67,22 @@ fs.readdir("./commands/", (_err, files) => {
let commandName = file.split(".")[0]; let commandName = file.split(".")[0];
client.commands.set(commandName, { client.commands.set(commandName, {
name: commandName, name: commandName,
...props ...props,
}); });
console.log(`👌 Command loaded: ${commandName}`); console.log(`👌 Command loaded: ${commandName}`);
}); });
synchronizeSlashCommands(client, client.commands.map((c) => ({ synchronizeSlashCommands(
client,
client.commands.map((c) => ({
name: c.name, name: c.name,
description: c.description, description: c.description,
options: c.options, options: c.options,
type: 'CHAT_INPUT' type: Discord.ApplicationCommandType.ChatInput,
})), { })),
debug: true {
}); debug: true,
}
);
}); });
/* Load all events */ /* Load all events */

2175
package-lock.json generated Normal file

File diff suppressed because it is too large Load diff

View file

@ -22,9 +22,9 @@
"homepage": "https://github.com/EmotionChild/Giveaway-Child#readme", "homepage": "https://github.com/EmotionChild/Giveaway-Child#readme",
"dependencies": { "dependencies": {
"beautify": "0.0.8", "beautify": "0.0.8",
"discord-giveaways": "^5.0.1", "discord-giveaways": "^6.0.1",
"discord-sync-commands": "0.3.0", "discord-sync-commands": "0.3.0",
"discord.js": "^13.9.0", "discord.js": "^14.6.0",
"fero-ms": "^2.0.7", "fero-ms": "^2.0.7",
"ms": "^2.1.3", "ms": "^2.1.3",
"quickdb": "1.0.5", "quickdb": "1.0.5",