ikoli
ikoli
SIASapphire - Imagine a framework
Created by ikoli on 11/18/2023 in #sapphire-support
Can't create new listener
Yep found at the moment! Thanks
8 replies
SIASapphire - Imagine a framework
Created by ikoli on 11/18/2023 in #sapphire-support
Can't create new listener
import { Listener } from '@sapphire/framework';
import type { Client } from 'discord.js';

export class ReadyListener extends Listener {
public constructor(context: Listener.LoaderContext, options: Listener.Options) {
super(context, {
...options,
once: true,
event: 'ready'
});
}
public run(client: Client) {
const { username, id } = client.user!;
this.container.logger.info(`Successfully logged in as ${username} (${id})`);
}
}
import { Listener } from '@sapphire/framework';
import type { Client } from 'discord.js';

export class ReadyListener extends Listener {
public constructor(context: Listener.LoaderContext, options: Listener.Options) {
super(context, {
...options,
once: true,
event: 'ready'
});
}
public run(client: Client) {
const { username, id } = client.user!;
this.container.logger.info(`Successfully logged in as ${username} (${id})`);
}
}
8 replies
SIASapphire - Imagine a framework
Created by ikoli on 11/18/2023 in #sapphire-support
Can't create new listener
"dependencies": {
"@sapphire/framework": "^4.8.2",
"discord.js": "^14.14.1",
"dotenv": "^16.3.1",
"nodemon": "^3.0.1",
"typescript": "^5.2.2"
}
"dependencies": {
"@sapphire/framework": "^4.8.2",
"discord.js": "^14.14.1",
"dotenv": "^16.3.1",
"nodemon": "^3.0.1",
"typescript": "^5.2.2"
}
8 replies
SIASapphire - Imagine a framework
Created by ikoli on 11/18/2023 in #sapphire-support
Can't create new listener
Error when loading 'C:\Users\Peter\Desktop\game\src\listeners\ready.ts': TypeError: Class constructor _Listener cannot be invoked without 'new'
at new ReadyListener (C:\Users\Peter\Desktop\game\src\listeners\ready.ts:23:42)
at _ListenerStore.construct (C:\Users\Peter\Desktop\game\node_modules\@sapphire\pieces\src\lib\structures\Store.ts:325:10)
at _ListenerStore.loadPath (C:\Users\Peter\Desktop\game\node_modules\@sapphire\pieces\src\lib\structures\Store.ts:354:17)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at _ListenerStore.loadAll (C:\Users\Peter\Desktop\game\node_modules\@sapphire\pieces\src\lib\structures\Store.ts:245:21)
at async Promise.all (index 3)
at _SapphireClient.login (C:\Users\Peter\Desktop\game\node_modules\@sapphire\framework\src\lib\SapphireClient.ts:352:3)
Error when loading 'C:\Users\Peter\Desktop\game\src\listeners\ready.ts': TypeError: Class constructor _Listener cannot be invoked without 'new'
at new ReadyListener (C:\Users\Peter\Desktop\game\src\listeners\ready.ts:23:42)
at _ListenerStore.construct (C:\Users\Peter\Desktop\game\node_modules\@sapphire\pieces\src\lib\structures\Store.ts:325:10)
at _ListenerStore.loadPath (C:\Users\Peter\Desktop\game\node_modules\@sapphire\pieces\src\lib\structures\Store.ts:354:17)
at processTicksAndRejections (node:internal/process/task_queues:95:5)
at _ListenerStore.loadAll (C:\Users\Peter\Desktop\game\node_modules\@sapphire\pieces\src\lib\structures\Store.ts:245:21)
at async Promise.all (index 3)
at _SapphireClient.login (C:\Users\Peter\Desktop\game\node_modules\@sapphire\framework\src\lib\SapphireClient.ts:352:3)
8 replies