#Command is not registering

1 messages · Page 1 of 1 (latest)

lime hare
#

i have a issue with register a translated command..

Current code is

import { ApplyOptions } from '@sapphire/decorators';
import { applyLocalizedBuilder } from '@sapphire/plugin-i18next';
import { ChatInputCommand, Command } from '@sapphire/framework';

@ApplyOptions<Command.Options>({
    description: 'ping pong'
})
export class UserCommand extends Command {
    public override registerApplicationCommands(registry: ChatInputCommand.Registry) {
        registry.registerChatInputCommand(
            (builder) => 
            applyLocalizedBuilder(builder, 'ping:CommandName', 'ping:CommandDescription')
        );
    }

    public override async chatInputRun(interaction: Command.ChatInputCommandInteraction) {
        await interaction.reply({
            content: 'Pong!',
            ephemeral: true
          });
      
    }
}
long turtleBOT
#

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

lime hare
runic rock
#

Is2g why are application commands failing for literally everyone today @hybrid dove stress stress stress stress

hybrid dove
#

???

#

wtf happened

#

everything worked fine for so long and randomly it breaks?

#

is this a cjs/esm moment??

runic rock
#

Nah doubt it. That's been fixed for a while now too.

hybrid dove
#

yeah but why did it randomly break now

#

after all this time

#

when it worked FINE

meager vapor
#

Maybe Discord shitting itself?

runic rock
#

For starters, please list all your dependencies @lime hare

hybrid dove
#

something strange is happening

#

are all plugins esm'd yet @runic rock if you remember

#

i know you're out

runic rock
#

yes

runic rock
#

hm

#

it works for me

hybrid dove
#

node version diffs?

runic rock
#

My thought is that @lime hare hasnt fully set up i18next

hybrid dove
#

doesn't explain the other issues

runic rock
#

those are separate and need separate investigation

#

@lime hare My current suspicion is that you havent setup @sapphire/plugin-i18next properly. Here is a zip with files that are based on the CLI generated template that show what needs to be done

The important parts are:

  1. Calling the /register of the plugin
  2. Configuring the languages for the plugin (see the config in src/index.ts)
  3. Adding the languages directory
  4. In languages add the appropriate languages subfolders
  5. In those subfolders create the JSON files (ping.json in your case becaus you references the keys as ping:Something)
  6. Add the appropriate keys in the JSON files, in your case CommandName and CommandDescription
  7. Ensure that TypeScript copies the JSON files when compiling by adding src/**/*.json to the includes array as well as enabling compilerOptions.resolveJsonModule

It should be noted that steps 4, 5 and 6 are directly related to the usage of i18next: https://www.i18next.com. By providing i18n you're taking on a big task of understanding how this framework works.

lime hare
#

I'll look later into it

#

Other question, related to that:

Can I put a subcommands into multiple files.

Like /voice lock own file and /voice unlock own file

runic rock
lime hare
runic rock
#

My code definitely works so go through everything once again

#

I tested it myself

lime hare
#

alright

lime hare
#

alr worked! Was just a missing import AGC_Pepeyup