#subcommands not working

1 messages ยท Page 1 of 1 (latest)

gilded tideBOT
#

To help others find answers, you can mark your question as solved via Right click solution message -> Apps -> โœ… Mark Solution

rose cargo
#

show your registerApplicationCommands

cunning birch
#

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

rose cargo
rose cargo
#

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

cunning birch
#

i thought i was up to date

#

yarn scammed me

rose cargo
#

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

cunning birch
#

oh i just found out i need to run yarn upgrade

rose cargo
#

rather yarn upgrade-interactive and for that you first ditch Yarn v1 which has been EOL for years

tepid scaffoldBOT
#

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
cunning birch
#

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

rose cargo
#

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

cunning birch
rose cargo
#

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 :^)

cunning birch
#

๐Ÿ˜ฆ

cunning birch
rose cargo
#

no but jokes aside

#

this kind of stuff you just need to learn to remember

#

that's the life of a developer

cunning birch
#

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

rose cargo
#

Press <left>/<right> to select versions.

cunning birch
#

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

rose cargo
#

idk then. Dump code on GH or something. It looks good at a glance.

rose cargo
#

or debug yourself shrug

#

make sure you dont have a chatInputRun

cunning birch
#

yeah i dont

cunning birch
#

its a very small project

rose cargo
#

ig

cunning birch
#

here

#

the subcommand not working is in /src/commands/settings/settings.ts

rose cargo
cunning birch
#

oh?

#

oh okay

#

tysm

#

it would push this file tho?

rose cargo
#

yes...

cunning birch
#

oh

#

okay

#

my bad

#

do you want me to include it in the repo rq?

#

or is everything good

rose cargo
#

like I said, I know what to do and that message was just for the future.

cunning birch
#

alright tysm for pointing that out

rose cargo
#

what is cls in the start script?

cunning birch
#

clears the terminal

#

only in windows though

rose cargo
cunning birch
#

ohhh

cunning birch
#

thank you so much favna

rose cargo
#
    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`
      );
    }
cunning birch
#

ur right

#

ive never used keyv before lmao

#

i just didnt wanna use prisma for a simple project like this

cunning birch
rose cargo
#

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.

rose cargo
rose cargo
cunning birch
#

i remember there used to be a command called git patch or something

rose cargo
#

that is used to create a patch

cunning birch
#
-  "extends": "@sapphire/ts-config",
+  "extends": [
+    "@sapphire/ts-config",
+    "@sapphire/ts-config/decorators",
+    "@sapphire/ts-config/extra-strict"
+  ],```
#

wait so what is wrong about this?

rose cargo
#

again, I refer to the README. This time that of @sapphire/ts-config

cunning birch
#

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

rose cargo
#

the readme literally has copy-pastable code so you say you have read it but I somehow doubt it ๐Ÿค” no offense

cunning birch
#
#

ah i just read the first line ๐Ÿคฆ

#

lmao

rose cargo
#

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.

cunning birch
#

all good i understand