From cf832a0e4a44891248252020cbabbc84699b4ea8 Mon Sep 17 00:00:00 2001 From: Slincnik Date: Thu, 26 Dec 2024 16:35:00 +0300 Subject: [PATCH] fix: fixing not initialized client in models --- src/structures/client.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/structures/client.js b/src/structures/client.js index b421ff3c..c1281c20 100644 --- a/src/structures/client.js +++ b/src/structures/client.js @@ -7,9 +7,6 @@ import logger from "../helpers/logger.js"; import ConfigService from "../services/config/index.js"; import InternationalizationService from "../services/languages/index.js"; import { SUPER_CONTEXT } from "../constants/index.js"; -import GuildModel from "../models/GuildModel.js"; -import UserModel from "../models/UserModel.js"; -import MemberModel from "../models/MemberModel.js"; export class ExtendedClient extends Client { /** @@ -48,6 +45,7 @@ export class ExtendedClient extends Client { * @returns {Promise} The guild data object, either retrieved from the database or newly created. */ async getGuildData(guildId) { + const { default: GuildModel } = await import("../models/GuildModel.js"); let guildData = await this.adapter.findOne(GuildModel, { id: guildId }); if (!guildData) { @@ -64,6 +62,7 @@ export class ExtendedClient extends Client { * @returns {Promise} The user data object, either retrieved from the database or newly created. */ async getUserData(userID) { + const { default: UserModel } = await import("../models/GuildModel.js"); let userData = await this.adapter.findOne(UserModel, { id: userID }); if (!userData) { @@ -81,6 +80,7 @@ export class ExtendedClient extends Client { * @returns {Promise} The member data object, either retrieved from the database or newly created. */ async getMemberData(memberId, guildId) { + const { default: MemberModel } = await import("../models/GuildModel.js"); let memberData = await this.adapter.findOne(MemberModel, { guildID: guildId, id: memberId }); if (!memberData) {