I am having a lot of trouble finding relevant documentation regarding how to find mutual server of interaction.user & bot.

I tried [this](https://stackoverflow.com/questions/62827582/discord-js-get-common-servers-between-two-users) & [this](https://stackoverflow.com/questions/63847540/get-all-guild-ids-with-discord-js) too, but no luck.

This is the code

```js
const { SlashCommandBuilder } = require('@discordjs/builders');
const { REST } = require('@discordjs/rest');
const { Routes } = require('discord-api-types/v9');
const { token } = require('../config.json');
const { MessageActionRow, MessageSelectMenu, Client, Intents } = require('discord.js');
const rest = new REST({ version: '9' }).setToken(token);

module.exports = {
    data: new SlashCommandBuilder()
        .setName('transfer-bans')
        .setDescription('Transfers Bans across servers'),

    async execute(interaction) {
        const emb = {
            description:'Guild fetcher',
        };
        const client = new Client({ intents: [Intents.FLAGS.GUILDS], partials: ['CHANNEL', 'REACTION'] });

        const guilds = await client.guilds.cache.map(guild => guild.id);
        console.log(guilds);

        const guilds2 = Promise.all(
            client.guilds.cache.map(async guild => [
                guild.id,
                await guild.members.fetch(interaction.member).catch(() => null),
            ]),
        ).then(guilds2 => guilds2.filter(g => g[1]).map(guild => client.guilds.resolve(guild[0])));
        console.log(guilds2);

        const row = new MessageActionRow()
            .addComponents(
                new MessageSelectMenu()
                    .setCustomId('select')
                    .setPlaceholder('Nothing selected')
                    .addOptions([
                        {
                            label: 'me',
                            description: 'description',
                            value: 'option_first',
                        },
                        {
                            label: 'me too',
                            description: ' description',
                            value: 'option_second',
                        },
                    ]),
            );
        await interaction.reply({ embeds:[emb], components: [row] });

    },
};

```

All I get in console.log is -

```
[nodemon] starting `node index.js`
Tue Oct 19 2021
Ready! Logged in as Ban Utlis#6717
MRDGH2821#7746 in #general triggered an interaction.
[]
Promise { <pending> }

```

My question is,

Q1.1. How do I fetch a list of guildIDs of all guilds in which my bot is present?  

*OR*  

Q1.2. How do I find mutual servers with respect to `interaction.user`?

Q2. How do I present the mutual servers dynamically in the [select menu](https://discordjs.guide/interactions/select-menus.html#select-menus) of the bot's message
 Check Edit 2

I'm using Discord.js v13. I even looked up their guide & documentation regarding mutual servers & nothing was found.

Bot source code hsted at [GitHub](https://github.com/MRDGH2821/Discord-Ban-Utils-Bot)

##### Edit 1

The implementation of fetching Bot's guild IDs in this code have no syntactical issue. The issue is, there is no guild IDs being printed to console.log

##### Edit 2

I got help from this [Pull Request](https://github.com/MRDGH2821/Discord-Ban-Utils-Bot/pull/2)

So here is a part of updated code:

```js
const guilds = [];
        for (const [, guild] of interaction.client.guilds.cache) {
            await guild.members.fetch(interaction.user).then(() => guilds.push(guild)).catch(error => console.log(error));
        }

        const servers = [];
        for (let i = 0; i < Object.keys(guilds).length;i++) {
            servers.push({ label: Object.entries(guilds)[i][1].name, value:Object.entries(guilds)[i][1].id });
        }

        const row = new MessageActionRow()
            .addComponents(
                new MessageSelectMenu()
                    .setCustomId('select')
                    .setPlaceholder('Nothing selected')
                    .addOptions(servers),
            );
        await interaction.editReply({ embeds:[emb], components: [row] });

```

So this fixed the guild fetching issue.

I even managed to present it into Select Menu.  

Which now brings to my 3rd question (Although the above given code snippet is the actual answer to title of this post)

Q3. Any guides on how to recieve interactions from select menu?

The discordjs [guide](https://discordjs.guide/popular-topics/collectors.html#interaction-collectors) on recieveing select menu interactions is not working in my context.

##### Edit 3

I felt it would be better to ask Q3 in seperate post rather than this.