Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

686
Views
Type annotations can only be used in TypeScript.ts(8010) files '(' expected.ts(1005)

I'm facing this problem right after when I added the construct and the class in the code, please help me I don't know what else to do, I've tried everything

Because without the constructor I can't access the database and without the data I can't create a slash command

const { Command, Embed } = require("../..");
const { SlashCommandBuilder } = require('@discordjs/builders');

module.exports = class PdAdd extends Command {
  constructor(client) {
    super(client, {
      dbOnly: true,
    });
  }
  
  data: new SlashCommandBuilder()
    .setName('speakconfig')
    .setDescription('Configurações de Fala!')
    .addSubcommand(subcommand => {
      return subcommand
      .setName('voz')
      .setDescription('Que tipo de voz você deseja?')
      .addStringOption(option => { 
        return option
        .setName('vozes')
        .setDescription('Selecione a voz desejada!')
        .addChoice('feminina', '1')
        .addChoice('masculina', '2')
        .setRequired(true)
      })
    })

  async run(interaction) {
    const doc = await this.client.db.guilds.get(interaction.guild.id, {}, {}, true);

    if (interaction.options.getSubcommand().getString() === '1') {
      doc.speakConfig.speakVoz.push("pt-BR-FranciscaNeural")
      await doc.save()

      interaction.reply({ content: `Voz alterada para Feminina.`, ephemeral: true})
        } else 
    
    if (interaction.options.getSubcommand().getString() === '2') {
      doc.speakConfig.speakVoz.push("pt-BR-AntonioNeural")
      await doc.save()

      interaction.reply({ content: `Voz alterada para Masculina.`, ephemeral: true})
        }
  }
}

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!