cant get guilds?

interacts dont give me a .guild only a .guildId cache does not have this guild nor can i fetch it (DiscordAPIError[10004]: Unknown Guild)
15 Replies
d.js toolkit
d.js toolkit3w ago
Solly
SollyOP3w ago
const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMembers, GatewayIntentBits.GuildPresences] }); i have all the intents
client.on("clientReady", () => {
console.log(`Logged in as ${client.user.tag}`);
console.log(client.guilds.cache.size)
client.guilds.cache.forEach(guild => console.log(guild));
});
client.on("clientReady", () => {
console.log(`Logged in as ${client.user.tag}`);
console.log(client.guilds.cache.size)
client.guilds.cache.forEach(guild => console.log(guild));
});
just prints 0
Solly
SollyOP3w ago
GitHub
GitHub - SollyBunny/Discord-Cake-Throw-Revived: Discord bot to thro...
Discord bot to throw cakes at eachother. Contribute to SollyBunny/Discord-Cake-Throw-Revived development by creating an account on GitHub.
Solly
SollyOP3w ago
using a different (older) bot clientid/token works as far as i can tell the bot settings are the exact same
duck
duck3w ago
it doesn't sound like your bot is actually in any guilds then have you double checked that you invited your bot with the bot scope instead of just the applications.commands scope?
Solly
SollyOP3w ago
ah no bot scope i only need to get display names (of the interactor and of a user inputted in an interaction) is there any way to do so without being a bot
duck
duck3w ago
afaik even when in a raw guild, you should still be able to access <ChatInputCommandInteraction>.member, <ChatInputCommandInteraction>.options.getMember(), and the equivalent properties for user so you should be able to put together something similar to <GuildMember>.displayName
Solly
SollyOP3w ago
thats what i thought (didnt know getMember was an option) but display* is nowhere to be seen
duck
duck3w ago
<ChatInputCommandInteraction>.member and getMember would just return raw member data rather than GuildMember objects
Solly
SollyOP3w ago
well i did see .nick available but i wanted the convenience of .displayName (incase .nick is nonexistant)
duck
duck3w ago
then you'd need to recreate <GuildMember>.displayName yourself you can take a peek under the hood if you'd like (though you'd need to use <Interaction>.user and .options.getUser() for the user)
Solly
SollyOP3w ago
okay thank u for the help
Solly
SollyOP3w ago
duck
duck3w ago
👍
d.js toolkit
d.js toolkit3w ago
The issue has been marked as solved by support staff

Did you find this page helpful?