feat: added support to giveaways manager

This commit is contained in:
Slincnik 2025-01-16 17:38:30 +03:00
parent 0327e8069f
commit 4272ae63b0
No known key found for this signature in database

View file

@ -1,4 +1,5 @@
import { Client, ClientOptions } from "discord.js"; import { Client, ClientOptions } from "discord.js";
import { GiveawaysManager } from "discord-giveaways";
import { TOptionsBase } from "i18next"; import { TOptionsBase } from "i18next";
import { Handlers } from "@/handlers/index.js"; import { Handlers } from "@/handlers/index.js";
import MongooseAdapter from "@/adapters/database/MongooseAdapter.js"; import MongooseAdapter from "@/adapters/database/MongooseAdapter.js";
@ -23,6 +24,17 @@ export class ExtendedClient extends Client<true> {
}, },
) => string; ) => string;
// @ts-ignore - because ExtendedClient != Client<boolean> from discord.js
giveaways = new GiveawaysManager(this, {
storage: "../../giveaways.json",
default: {
botsCanWin: false,
embedColor: this.configService.get("embed.color"),
embedColorEnd: "#FF0000",
reaction: "🎉",
},
});
constructor(options: ClientOptions) { constructor(options: ClientOptions) {
if (SUPER_CONTEXT.getStore()) { if (SUPER_CONTEXT.getStore()) {
return SUPER_CONTEXT.getStore() as ExtendedClient; return SUPER_CONTEXT.getStore() as ExtendedClient;