#bot not seeing users

6 messages · Page 1 of 1 (latest)

trail kelp
#

I have the following code which I'm using to attempt to add 2 separate currencies to users, however my bot is only seeing itself. I have a feeling it's because I don't fully understand how the redirect works. The bot is in my server with administrator permissions, and has Server Members Intent, Presence Intent, and Message Intent. Additionally, the oauth url I generated had bot, identify, messages.read, and all guilds permissions.```js
//Attempting to call processMembers for all members in order to add members currency to tables.
client.once('ready', () => {
const guild = client.guilds.cache.get(guildId);
if (guild) {
console.log('Using cached members.');
const members = guild.members.cache;

    if (members.size === 1) {
        console.log('No cached members found. Fetching members...');
        guild.members.fetch()
            .then(fetchedMembers => {
                console.log(`Fetched ${fetchedMembers.size} members.`);
                processMembers(fetchedMembers);
            })
            .catch(err => console.error('Failed to fetch members:', err));
    } else {
        console.log(`Cached members found: ${members.size}`);
        processMembers(members);
    }
} else {
    console.error(`No guild found with ID: ${guildId}`);
}
console.log(`Ready! Logged in as ${client.user.tag}`);

});

function processMembers(members) {
members.forEach(member => {
console.log('Processing for each member.');
unity_credits.set(member.user.id, 60);
commerce_credits.set(member.user.id, 60);
console.log(Unity credits for ${member.user.username}: ${unity_credits.get(member.user.id)});
console.log(Commerce credits for ${member.user.username}: ${commerce_credits.get(member.user.id)});
});
}

Current output is as follows:```plaintext
Using cached members.
No cached members found. Fetching members...
Ready! Logged in as The Arbiter#4578```
muted patioBOT
#
  • What's your exact discord.js npm list discord.js and node node -v version?
  • Not a discord.js issue? Check out #1081585952654360687.
  • Consider reading #how-to-get-help to improve your question!
  • Explain what exactly your issue is.
  • Post the full error stack trace, not just the top part!
  • Show your code!
  • Issue solved? Press the button!
  • Marked as resolved by OP
trail kelp
#

node -v 20.5.0

peak sequoia
#

and what intents did you specify in your client constructor

#

additionally, scopes other than bot and application.commands wont do anything

trail kelp
#

Thank you, I was so focused on that bit of code and the setup of the bot side of things I missed setting up the client in the code