Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

331
Visualizações
Property assignment expected error on TypeScript

I have ran into an issue with my Discord bot's audit log system. I am trying to make it have have automatic entries for the bot guilds. It cannot take `` strings with ${guild.id} inside.

Here is my code:

client.guilds.cache.forEach(async (guild: any) => {
            guildPrefs = await guildModel.findOne({ GuildID: guild.id }).catch(err => console.log(err));
            let guildId: string = '';
    
            guildId = `${guild.id}`

            await audit(client, {
                `${guild.id}`: {
                    auditlog: guildPrefs.AuditChannel,
                    auditmsg: guildPrefs.AuditChannel,
                    voice: guildPrefs.AuditChannel,
                    trackroles: true
                }
            });
        })
    })

The audit log system I am using is this one: https://www.npmjs.com/package/discord-auditlog but embedded right into the bot.

This is how it shows on VS Code.

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

You can use your template literal string in your object key by using bracket notation. Like this:


    [`${guild.id}`]: {
        auditlog: guildPrefs.AuditChannel,
        auditmsg: guildPrefs.AuditChannel,
        voice: guildPrefs.AuditChannel,
        trackroles: true
    }

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda