#cant get guilds?
25 messages · Page 1 of 1 (latest)
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));
});
just prints 0
Discord bot to throw cakes at eachother. Contribute to SollyBunny/Discord-Cake-Throw-Revived development by creating an account on GitHub.
using a different (older) bot clientid/token works
as far as i can tell the bot settings are the exact same
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?
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
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
thats what i thought
(didnt know getMember was an option)
but display* is nowhere to be seen
<ChatInputCommandInteraction>.member and getMember would just return raw member data rather than GuildMember objects
well i did see .nick available but i wanted the convenience of .displayName
(incase .nick is nonexistant)
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)
👍