This repository was archived by the owner on Feb 14, 2024. It is now read-only.
-
-
Notifications
You must be signed in to change notification settings - Fork 33
Expand file tree
/
Copy pathgiveawayInit.js
More file actions
41 lines (32 loc) · 1.12 KB
/
giveawayInit.js
File metadata and controls
41 lines (32 loc) · 1.12 KB
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
const { GiveawaysManager } = require("discord-giveaways");
const giveawayModel = require('./schemas/giveawaysSchema');
module.exports = (client) =>{
class GiveawayManagerCustom extends GiveawaysManager {
async getAllGiveaways() {
return await giveawayModel.find().lean().exec();
}
async saveGiveaway(messageId, giveawayData) {
await giveawayModel.create(giveawayData);
return true;
}
async editGiveaway(messageId, giveawayData) {
await giveawayModel.updateOne({ messageId }, giveawayData, { omitUndefined: true }).exec();
return true;
}
async deleteGiveaway(messageId) {
await giveawayModel.deleteOne({ messageId }).exec();
return true;
}
};
const manager = new GiveawayManagerCustom(client, {
storage: false,
updateCountdownEvery: 10000,
default: {
botsCanWin: false,
exemptPermissions: [],
embedColor: "#FF0000",
reaction: "🎉"
}
});
client.giveawaysManager = manager
}