Peace
Peace
Explore posts from servers
SIASapphire - Imagine a framework
Created by Peace on 7/24/2024 in #sapphire-support
Compilation Errors in Dependencies
Hey, I'm trying to create a new project, but when running tsc to build the bot I get many errors.
node_modules/@sapphire/result/dist/cjs/index.d.cts:832:5 - error TS2416: Property 'isOkAnd' in type 'ResultOk<T>' is not assignable to the same property in base type 'IResult<T, any>'.
Type '<R extends boolean>(cb: (value: T) => R) => R' is not assignable to type '<R extends boolean>(cb: (value: T) => R) => this is ResultOk<T> & R'.
Signature '(cb: (value: T) => R): R' must be a type predicate.

832 isOkAnd<R extends boolean>(cb: (value: T) => R): R;
node_modules/@sapphire/result/dist/cjs/index.d.cts:832:5 - error TS2416: Property 'isOkAnd' in type 'ResultOk<T>' is not assignable to the same property in base type 'IResult<T, any>'.
Type '<R extends boolean>(cb: (value: T) => R) => R' is not assignable to type '<R extends boolean>(cb: (value: T) => R) => this is ResultOk<T> & R'.
Signature '(cb: (value: T) => R): R' must be a type predicate.

832 isOkAnd<R extends boolean>(cb: (value: T) => R): R;
There are more errors in this file from similar methods (isErr, isErrAnd, isNone, ...) And also some errors between @types/node and discord.js.
node_modules/@types/node/events.d.ts:503:30 - error TS2300: Duplicate identifier 'EventEmitter'.

503 export { internal as EventEmitter };
~~~~~~~~~~~~
node_modules/discord.js/typings/index.d.ts:246:9
246 class EventEmitter {
~~~~~~~~~~~~
'EventEmitter' was also declared here.
node_modules/@types/node/events.d.ts:503:30 - error TS2300: Duplicate identifier 'EventEmitter'.

503 export { internal as EventEmitter };
~~~~~~~~~~~~
node_modules/discord.js/typings/index.d.ts:246:9
246 class EventEmitter {
~~~~~~~~~~~~
'EventEmitter' was also declared here.
And similar ones I thought maybe me dependencies do not match or so, but I tried using other versions too and didn't notice anything different Here are my deps
"dependencies": {
"@prisma/client": "^5.17.0",
"@sapphire/decorators": "^6.1.0",
"@sapphire/framework": "^5.2.1",
"@sapphire/plugin-logger": "^4.0.2",
"@sapphire/utilities": "^3.17.0",
"@skyra/env-utilities": "^1.3.0",
"colorette": "^2.0.20",
"discord.js": "14.x"
},
"devDependencies": {
"@sapphire/eslint-config": "^5.0.5",
"@sapphire/ts-config": "^5.0.1",
"@types/node": "^20.14.12",
"@typescript-eslint/eslint-plugin": "^7.17.0",
"@typescript-eslint/parser": "^7.17.0",
"eslint": "8.57.0",
"eslint-config-prettier": "^9.1.0",
"prettier": "^3.3.3",
"prisma": "^5.17.0",
"tsc-watch": "^6.2.0",
"typescript": "*"
}
"dependencies": {
"@prisma/client": "^5.17.0",
"@sapphire/decorators": "^6.1.0",
"@sapphire/framework": "^5.2.1",
"@sapphire/plugin-logger": "^4.0.2",
"@sapphire/utilities": "^3.17.0",
"@skyra/env-utilities": "^1.3.0",
"colorette": "^2.0.20",
"discord.js": "14.x"
},
"devDependencies": {
"@sapphire/eslint-config": "^5.0.5",
"@sapphire/ts-config": "^5.0.1",
"@types/node": "^20.14.12",
"@typescript-eslint/eslint-plugin": "^7.17.0",
"@typescript-eslint/parser": "^7.17.0",
"eslint": "8.57.0",
"eslint-config-prettier": "^9.1.0",
"prettier": "^3.3.3",
"prisma": "^5.17.0",
"tsc-watch": "^6.2.0",
"typescript": "*"
}
Does someone has an idea how to fix this?
4 replies
DIAdiscord.js - Imagine an app
Created by Peace on 11/28/2023 in #djs-questions
Cache or Fetch
Hey guys, So I've been using Discord.js for a while now. But I still don't understand in which cases I can use cache and in which cases I have to use fetch. What is the best practice here? D:
4 replies
SIASapphire - Imagine a framework
Created by Peace on 11/14/2023 in #sapphire-support
Subcommand wont get registered
No description
7 replies
SIASapphire - Imagine a framework
Created by Peace on 8/29/2023 in #sapphire-support
GuildMemberRemove not running
I just think I'm overlooking something but... I'm trying to do something if a member leaves the guild, but the event is not running. I have the following intends: - Guilds - GuildMembers - GuildPresences I also added the partial "GuildMember". The Listener looks like this:
export class SomeListener extends Listener<typeof Events.GuildMemberRemove> {
public async run(member: GuildMember) {
console.log('TEST');
}
}
export class SomeListener extends Listener<typeof Events.GuildMemberRemove> {
public async run(member: GuildMember) {
console.log('TEST');
}
}
9 replies
SIASapphire - Imagine a framework
Created by Peace on 8/28/2023 in #sapphire-support
Custom Error Event
So I know, I can use UserError to throw an error if the user did something wrong. But what to throw if something unexpected happend, like a 500 to my own api. I thought maybe the normal Error but it isn't handled by the ChatInputCommandError Event. I want the user to get a error message in chat, so I need to use the interaction. Do I have to throw something else? Or do I have to listen to another event? Thanks :3
5 replies
DIAdiscord.js - Imagine an app
Created by Peace on 4/27/2023 in #djs-questions
Examples and Templates
Hello, I have experience building multiple bots, but I have encountered the same problem every time. The file structure or the framework I use doesn't work well, making everything more complicated than necessary. This issue becomes more apparent when I attempt to integrate a web API for frontend usage, causing everything to fall apart. Do you have any good examples, templates or frameworks that I can look at for inspiration?
2 replies
DIAdiscord.js - Imagine an app
Created by Peace on 10/28/2022 in #djs-questions
deferUpdate with MessageComponentCollector
6 replies