diff --git a/src/handlers/event-handler/index.js b/src/handlers/event-handler/index.js index c63d2dc7..0144bbba 100644 --- a/src/handlers/event-handler/index.js +++ b/src/handlers/event-handler/index.js @@ -3,6 +3,7 @@ import logger from "../../helpers/logger.js"; import useClient from "../../utils/use-client.js"; import { getFilePaths } from "../../utils/index.js"; import { toFileURL } from "../../utils/resolve-file.js"; +import { useMainPlayer } from "discord-player"; export const events = []; @@ -39,7 +40,9 @@ const buildEvents = async () => { const registerEvents = async () => { const client = useClient(); + const player = useMainPlayer(); for (const { data, run } of events) { + if (data.player) player.events.on(data.name, run); if (data.once) client.once(data.name, run); else client.on(data.name, run); } diff --git a/src/structures/client.js b/src/structures/client.js index a25c9f47..b875e1d7 100644 --- a/src/structures/client.js +++ b/src/structures/client.js @@ -1,4 +1,5 @@ import { Client } from "discord.js"; +import { Player } from "discord-player"; import MongooseAdapter from "../adapters/database/MongooseAdapter.js"; import { init as initCommands } from "../handlers/command-handler/index.js"; import { init as initEvents } from "../handlers/event-handler/index.js"; @@ -20,6 +21,7 @@ export class ExtendedClient extends Client { this.configService = new ConfigService(); this.adapter = new MongooseAdapter(this.configService.get("mongoDB")); this.i18n = new InternationalizationService(this); + new Player(this); SUPER_CONTEXT.enterWith(this); }