Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

330
Vistas
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 Respuestas
Responde la pregunta

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 Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda