'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})
}
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
