Ahmad A.
Explore posts from serversDIAdiscord.js - Imagine an app
•Created by Ahmad A. on 12/3/2023 in #djs-questions
super.user error after updating packages
Code
Error:
import { Client as BaseClient, ClientUser, Collection, GatewayIntentBits } from "discord.js";
import IClient from "../Interfaces/Client.js";
import Command from "../Interfaces/Command.js";
import ClientConfig from "../Interfaces/ClientConfig.js";
import CommandHandler from "../handlers/commandHandler.js";
import EventHandler from "../handlers/eventHandler.js";
import Modal from "../Interfaces/Modal.js";
import ModalHandler from "../handlers/modalHandler.js";
import { PasteClient } from "pastebin-api";
import secrets from "../json/secrets.json" assert { type: "json" };
import sendLog from "../functions/sendLog.js";
class Client extends BaseClient implements IClient {
public readonly commands: Collection<string, Command>;
public readonly modals: Collection<string, Modal>;
public user: ClientUser;
public pastebin: PasteClient;
constructor() {
super({
intents: [GatewayIntentBits.Guilds],
allowedMentions: { parse: ["users"] },
});
this.commands = new Collection<string, Command>();
this.modals = new Collection<string, Modal>();
this.user = super.user as ClientUser;
this.pastebin = new PasteClient(this.config.pastebin);
}
config = secrets as unknown as ClientConfig;
async init() {
await sendLog(`[SYSTEM] Handlers have been initiated.`);
await CommandHandler(this);
await EventHandler(this);
await ModalHandler(this);
await this.login(this.config.token);
}
}
export default Client;
import { Client as BaseClient, ClientUser, Collection, GatewayIntentBits } from "discord.js";
import IClient from "../Interfaces/Client.js";
import Command from "../Interfaces/Command.js";
import ClientConfig from "../Interfaces/ClientConfig.js";
import CommandHandler from "../handlers/commandHandler.js";
import EventHandler from "../handlers/eventHandler.js";
import Modal from "../Interfaces/Modal.js";
import ModalHandler from "../handlers/modalHandler.js";
import { PasteClient } from "pastebin-api";
import secrets from "../json/secrets.json" assert { type: "json" };
import sendLog from "../functions/sendLog.js";
class Client extends BaseClient implements IClient {
public readonly commands: Collection<string, Command>;
public readonly modals: Collection<string, Modal>;
public user: ClientUser;
public pastebin: PasteClient;
constructor() {
super({
intents: [GatewayIntentBits.Guilds],
allowedMentions: { parse: ["users"] },
});
this.commands = new Collection<string, Command>();
this.modals = new Collection<string, Modal>();
this.user = super.user as ClientUser;
this.pastebin = new PasteClient(this.config.pastebin);
}
config = secrets as unknown as ClientConfig;
async init() {
await sendLog(`[SYSTEM] Handlers have been initiated.`);
await CommandHandler(this);
await EventHandler(this);
await ModalHandler(this);
await this.login(this.config.token);
}
}
export default Client;
src/structures/Client.ts:26:23 - error TS2855: Class field 'user' defined by the parent class is not accessible in the child class via super.
26 this.user = super.user as ClientUser;
~~~~
Found 1 error in src/structures/Client.ts:26
src/structures/Client.ts:26:23 - error TS2855: Class field 'user' defined by the parent class is not accessible in the child class via super.
26 this.user = super.user as ClientUser;
~~~~
Found 1 error in src/structures/Client.ts:26
40 replies