Listeners not registering?

I'm using sapphire with TS & TSUP, but registers aren't working... listener code:
import { Events, Listener } from "@sapphire/framework";
import { ActivityType, type Client } from "discord.js";

export class ClientReadyListener extends Listener {
public constructor(
context: Listener.LoaderContext,
options: Listener.Options
) {
super(context, {
...options,
event: Events.ClientReady,
once: true,
});
}

public run(client: Client) {
client.logger.info(
`Bot Client Logged in as ${client.user!.tag} (${client.application?.id})`
);

client.user!.setActivity({
type: ActivityType.Watching,
name: "over EBC",
});
}
}
import { Events, Listener } from "@sapphire/framework";
import { ActivityType, type Client } from "discord.js";

export class ClientReadyListener extends Listener {
public constructor(
context: Listener.LoaderContext,
options: Listener.Options
) {
super(context, {
...options,
event: Events.ClientReady,
once: true,
});
}

public run(client: Client) {
client.logger.info(
`Bot Client Logged in as ${client.user!.tag} (${client.application?.id})`
);

client.user!.setActivity({
type: ActivityType.Watching,
name: "over EBC",
});
}
}
file structure: https://fisher.likes-to.party/i/AFEnbv
Solution:
could you try changing main to dist/main.js
Jump to solution
5 Replies
fisher
fisherOP6mo ago
Sapphire is starting because I'm getting
[INFO] ApplicationCommandRegistries: Initializing...
[INFO] ApplicationCommandRegistries: Took 0ms to initialize.
[INFO] ApplicationCommandRegistries: Initializing...
[INFO] ApplicationCommandRegistries: Took 0ms to initialize.
kyra
kyra6mo ago
Can you show your package.json?
fisher
fisherOP6mo ago
sure
{
"name": "bot",
"version": "0.0.0",
"description": "",
"main": "src/main.ts",
"type": "module",
"scripts": {
"watch": "nodemon --watch src --exec tsup src --format esm",
"start": "nodemon dist/main.js",
"dev": "pnpm run \"/^(watch|start)/\""
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@discordjs/builders": "^1.8.2",
"@sapphire/framework": "^5.2.1",
"chalk": "^5.3.0",
"discord.js": "14.x",
"dotenv": "^16.4.5",
"marked": "^13.0.2"
},
"devDependencies": {
"nodemon": "^3.1.4",
"tsup": "^8.1.0",
"typescript": "^5.5.3"
}
}
{
"name": "bot",
"version": "0.0.0",
"description": "",
"main": "src/main.ts",
"type": "module",
"scripts": {
"watch": "nodemon --watch src --exec tsup src --format esm",
"start": "nodemon dist/main.js",
"dev": "pnpm run \"/^(watch|start)/\""
},
"keywords": [],
"author": "",
"license": "ISC",
"dependencies": {
"@discordjs/builders": "^1.8.2",
"@sapphire/framework": "^5.2.1",
"chalk": "^5.3.0",
"discord.js": "14.x",
"dotenv": "^16.4.5",
"marked": "^13.0.2"
},
"devDependencies": {
"nodemon": "^3.1.4",
"tsup": "^8.1.0",
"typescript": "^5.5.3"
}
}
it's also been a hot minute since I've made a bot so I might be missing something
Solution
UndiedGFX
UndiedGFX6mo ago
could you try changing main to dist/main.js
fisher
fisherOP6mo ago
that was the fix thanks!

Did you find this page helpful?