-
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex4giveaways.js
43 lines (36 loc) · 1.29 KB
/
index4giveaways.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
const Discord = require('discord.js');
const client = new Discord.Client();
const {GiveawaysManager} = require("discord-giveaways");
const db = require('quic.db');
if (!db.get("giveaways")) db.set("giveaways", []);
const GiveawayManagerWithOwnDatabase = class extends GiveawaysManager {
async getAllGiveaways() {
return db.get("giveaways");
}
async saveGiveaway(messageID, giveawayData) {
db.push("giveaways", giveawayData);
return true;
}
async editGiveaway(messageID, giveawayData) {
const giveaways = db.get("giveaways");
const newGiveawaysArray = giveaways.filter((giveaway) => giveaway.messageID !== messageID);
newGiveawaysArray.push(giveawayData);
db.set("giveaways", newGiveawaysArray);
return true;
}
async deleteGiveaway(messageID) {
const newGiveawaysArray = db.get("giveaways").filter((giveaway) => giveaway.messageID !== messageID);
db.set("giveaways", newGiveawaysArray);
return true;
}
};
const manager = new GiveawayManagerWithOwnDatabase(client, {
storage: false,
updateCountdownEvery: 5000,
default: {
botsCanWin: false,
exemptPermissions: ["Administrator"],
embedColor: "#FF0000",
reaction: `${emotes.autre.giveaway_1}`
}
});