#subcommands not working
1 messages ยท Page 1 of 1 (latest)
show your registerApplicationCommands
2nd time ive had to open support here for subcommands xd
all good tho hopefully this can get fixed
it was working before sapphire updated then after i updated it doesnt work anymore
show your package.json then
btw you can send multiple attachments per discord message yaknow ๐
whoops sorry
update your dependencies fully, as you can see in the last message in #Announcements the latest release of framework is 4.8.2 and especially since there was a regression bug in 4.8.1 and both are within caret semver range of 4.7.2 you should update your dependencies properly
does running yarn not work
i thought i was up to date
yarn scammed me
already up-to-date means your node_modules are up-to-date with your dependencies, not that your dependencies themselves are up-to-date.
it didnt scam you, it did exactly what it set out to do
oh i just found out i need to run yarn upgrade
rather yarn upgrade-interactive and for that you first ditch Yarn v1 which has been EOL for years
Yarn v4 is new version of Yarn that we recommend switching to as Yarn v1 has long since been deprecated.
"But I don't see any update on [source]?"
That is correct. Yarn v4 is installed through Yarn itself. You configure Yarn v4 on a per-project basis. How you installed Yarn globally is largely irrelevant to this (corepack, volta, something else). How to install Yarn v4 for your project? Simply write:
yarn set version berry
This will download the new Yarn v4 binary and put in .yarn/releases, you should push this to your Git repository. It will also create a .yarnrc.yml file which configures the path which you should also commit.
Next you probably also want to run the following 2 commands:
yarn config set enableGlobalCache true
yarn config set nodeLinker node-modules
This will add to your .yarnrc file:
enableGlobalCache: true
nodeLinker: node-modules
This ensures you have a more traditional experience with node_modules and a global cache.
The next step is to nuke your node_modules and yarn.lock and run yarn install
Then some final adjustments. Put this in you .gitignore:
# Yarn files
.yarn/install-state.gz
.yarn/build-state.yml
And anywhere in your scripts in package.json where you use * you should wrap it in extra "
For example:
{
"format": "prettier --write \"src/**/*.ts\""
}
Mind you this last thing is a good thing to add regardless of script runner / package bundler because it ensures the glob is performed by the library and not by your shell, which may differ when people develop on different operating systems.
In short, the command to set everything up you can run:
yarn set version berry && yarn config set enableGlobalCache true && yarn config set nodeLinker node-modules && echo "" >> .gitignore && echo "# Yarn files" >> .gitignore && echo ".yarn/install-state.gz" >> .gitignore && echo ".yarn/build-state.yml" >> .gitignore
how can i make it like
global?
the yarn v4
because im using yarn v4 in other projects but in this one its yarn v1
by installing yarn v4 globally. Depends on how you manage your global dependencies and how you installed yarn in the first place.
regardless you should still configure it per project
in fact it wont work properly if you dont
i would forget how lol
then write a post it note and stick it to your monitor. Then write another one with the text "forgetful goof" and stick it to your head :^)
๐ฆ
tysm i think everything should work now
no but jokes aside
this kind of stuff you just need to learn to remember
that's the life of a developer
yeah true
also uh
one more question
how do i select them
i know it says press up/down but when i press that it just goes through the different packages
Press <left>/<right> to select versions.
oh
tysm
i have to put the green one on the version number
haha i didnt realsie that
also @rose cargo
subcommands still dont work for some reason
idk then. Dump code on GH or something. It looks good at a glance.
yeah i dont
if i dump code rn can you look at it rn?
its a very small project
ig
here
the subcommand not working is in /src/commands/settings/settings.ts
fyi you have to push .yarn. Please re-read the message from @tepid scaffold for what you can ignore from the directory. It is that I know what to do but OOTB that code wouldnt work
yes...
oh
okay
my bad
do you want me to include it in the repo rq?
or is everything good
like I said, I know what to do and that message was just for the future.
alright tysm for pointing that out
what is cls in the start script?
The reason it doesn't work is because you wrote import "@sapphire/plugin-subcommands"; and not import "@sapphire/plugin-subcommands/register";: https://github.com/nicklvh/bot/blob/master/src/index.ts
See: https://github.com/sapphiredev/plugins/tree/main/packages/subcommands#usage
ohhh
ah i feel so stupid bro
thank you so much favna
there are also other mistakes covered by this patch
const channels = await this.container.keyv.get("channels");
if (!channels.length || !channels) {
await this.container.keyv.set("channels", [channel.id]);
return interaction.reply(
`Added ${channel} to list of available channels`
);
}
and this will error as well because you first try to read .length of channels and only THEN check if channels is defined at all or not. You should flip them. In fact what it should be is
if (channels?.length === 0) {
await this.container.keyv.set("channels", [channel.id]);
return interaction.reply(
`Added ${channel} to list of available channels`
);
}
ohh
ur right
ive never used keyv before lmao
i just didnt wanna use prisma for a simple project like this
how do i apply this patch
this isn't about using keyv or not, this is about the basic logic of not trying to read a property before checking if it's defined or not.
yeah youre right
fyi for simple questions like this you'd do really good just to google them or since it's 2023 use chatgpt
i mean i did but it told me to use diff or something
i remember there used to be a command called git patch or something
that is used to create a patch
- "extends": "@sapphire/ts-config",
+ "extends": [
+ "@sapphire/ts-config",
+ "@sapphire/ts-config/decorators",
+ "@sapphire/ts-config/extra-strict"
+ ],```
wait so what is wrong about this?
again, I refer to the README. This time that of @sapphire/ts-config
yeah i used to but i never got how to use the /decorators and /extra-strict parts of the ts-config
so i just went into them and copied them straight into the compiler options
the readme literally has copy-pastable code so you say you have read it but I somehow doubt it ๐ค no offense
where? i never saw that
ah i just read the first line ๐คฆ
lmao
also i'm sorry but i'm going to strip the Helpers role off of you. If anything you've shown me that you're really not a very skilled programmer let alone skilled with Sapphire so I don't see how you could feasibly be helping others.
all good i understand