Slash commands are not being registered when using Bun
Hello, I'm having trouble running the framework with bun because the slash commands are not being registered.
I created a new empty project with
bun init
and then installed discord.js
and @sapphire/framework
My index.ts
file, which is the entrypoint, looks like this:
and I have a directory commands
with the file test.ts
inside of it. this is what it looks like:
- I added the console.log
s just to be sure that it actually wasn't being called.
so when I run bun run src/index.ts
this is the output I get:
and the command(s) never get registered, I even tried setting up the guildIds for a specific server for it to be faster, but it didn't work either.
However, when I run the same code with node, the console.log
s get printed to the terminal, and the commands are registered. This is the output running the same code with node:
23 Replies
@vladdy
huh, funky
can you make a repro repo please @emo
could it be that the command doesnt appear to be virtual @vladdy ?
shouldn't be, because bun supports fs reading fixed that in latest version remember
i mean I TRIED IT WITH new highlight and it just worked
sure, not at home atm but as soon as I get there I'll create the repo
Hey! I just figured it out lol
So when you run
bun init
it generates the package.json file with the fields
if you change the module
field to main
it works. I'm not sure why or how that works, but it does lol
@vladdy sorry for pinging, but just so you know what I didI think I know why that happens
I'll look into it
Solution
@emo once that Pr is released the issue should be fixed
that if check is useless
I know, it's just code readability
fair
but its still useless
the first part that is
pushed
favna
do i need to teach you control
no
refresh
@Favna chore: nobody had ever created a function like this one before.Checks out
i just love how theres multiple entrypoint possibilities in package.json
ikr
JS lanscape is so fantastic
also hold on im gonna cover this function with unit tests
its not needed
but what if I want to
doesnt change the fact its not needed i aint stopping u
have at it
@emo in lieu of a final review on the PR you can already use the new version by setting the PR version in your package overrides/resolutions.
@sapphire/pieces@pr-369
sure, thanks