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

190
Vistas
How do you grant access to the server information (guilds, members, applications.commands) for your discord application?

Hey guys I'm currently developing a discord application that is connected to a firebase app. In this discord application I created a command /init-hub that allow user to create a document in this firebase firestore with the reference equal to the discord server id (one hub = one server).

Here is my problem,

I created this command :

 run: async (client: Client, interaction: BaseCommandInteraction) => {
        if (!interaction.guildId) {
            await interaction.followUp({
                ephemeral: true,
                content: 'Unable to create HUB for this server, contact us'
            });
            return;
        }

        const content = "Hub generated";
        // Get firestore db
        const db = admin.firestore();
        // ID OF THE SERVER
        const guild = client.guilds.cache.get(interaction.guildId);
        console.log(guild);

The log returned here is "undefined" but before I remove my app from my server and add it again (I Had an issue) this function worked perfectly.

Should I change the way I'm "fetching" my guild ? is there another way to do it with just the ID ?

I think my problem is coming from the "scope" or permissions in the invite URL for my application if anybody could tell me how I should create this URL here is mine :

https://discord.com/api/oauth2/authorize?client_id=[CLIENT_ID]&redirect_uri=https%3A%2F%2Fdiscordapp.com%2Foauth2%2Fauthorize%3F%26client_id%3D[CLIENT_ID]%26scope%3Dguilds%2520applications.commands&response_type=code&scope=guilds%20guilds.members.read%20rpc.voice.read%20applications.commands

Also in my discord client I specified those Intents :

const client = new Client({
    intents: [
        Intents.FLAGS.GUILD_MESSAGES,
        Intents.FLAGS.GUILDS,
        Intents.FLAGS.GUILD_VOICE_STATES,
        Intents.FLAGS.GUILD_MEMBERS,
        Intents.FLAGS.DIRECT_MESSAGES,
    ]
});

UPDATE :

When I try with this code :

const guild = await client.guilds.fetch(interaction.guildId);

I receive this error : DiscordAPIError: Missing Access

about 4 years ago · Juan Pablo Isaza
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