mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-12-28 14:23:02 +05:00
fix: fixing not initialized client in models
This commit is contained in:
parent
b45f3dcc35
commit
cf832a0e4a
1 changed files with 3 additions and 3 deletions
|
@ -7,9 +7,6 @@ import logger from "../helpers/logger.js";
|
||||||
import ConfigService from "../services/config/index.js";
|
import ConfigService from "../services/config/index.js";
|
||||||
import InternationalizationService from "../services/languages/index.js";
|
import InternationalizationService from "../services/languages/index.js";
|
||||||
import { SUPER_CONTEXT } from "../constants/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 {
|
export class ExtendedClient extends Client {
|
||||||
/**
|
/**
|
||||||
|
@ -48,6 +45,7 @@ export class ExtendedClient extends Client {
|
||||||
* @returns {Promise<GuildModel>} The guild data object, either retrieved from the database or newly created.
|
* @returns {Promise<GuildModel>} The guild data object, either retrieved from the database or newly created.
|
||||||
*/
|
*/
|
||||||
async getGuildData(guildId) {
|
async getGuildData(guildId) {
|
||||||
|
const { default: GuildModel } = await import("../models/GuildModel.js");
|
||||||
let guildData = await this.adapter.findOne(GuildModel, { id: guildId });
|
let guildData = await this.adapter.findOne(GuildModel, { id: guildId });
|
||||||
|
|
||||||
if (!guildData) {
|
if (!guildData) {
|
||||||
|
@ -64,6 +62,7 @@ export class ExtendedClient extends Client {
|
||||||
* @returns {Promise<UserModel>} The user data object, either retrieved from the database or newly created.
|
* @returns {Promise<UserModel>} The user data object, either retrieved from the database or newly created.
|
||||||
*/
|
*/
|
||||||
async getUserData(userID) {
|
async getUserData(userID) {
|
||||||
|
const { default: UserModel } = await import("../models/GuildModel.js");
|
||||||
let userData = await this.adapter.findOne(UserModel, { id: userID });
|
let userData = await this.adapter.findOne(UserModel, { id: userID });
|
||||||
|
|
||||||
if (!userData) {
|
if (!userData) {
|
||||||
|
@ -81,6 +80,7 @@ export class ExtendedClient extends Client {
|
||||||
* @returns {Promise<MemberModel>} The member data object, either retrieved from the database or newly created.
|
* @returns {Promise<MemberModel>} The member data object, either retrieved from the database or newly created.
|
||||||
*/
|
*/
|
||||||
async getMemberData(memberId, guildId) {
|
async getMemberData(memberId, guildId) {
|
||||||
|
const { default: MemberModel } = await import("../models/GuildModel.js");
|
||||||
let memberData = await this.adapter.findOne(MemberModel, { guildID: guildId, id: memberId });
|
let memberData = await this.adapter.findOne(MemberModel, { guildID: guildId, id: memberId });
|
||||||
|
|
||||||
if (!memberData) {
|
if (!memberData) {
|
||||||
|
|
Loading…
Reference in a new issue