#cant get guilds?

25 messages · Page 1 of 1 (latest)

civic relic
#

interacts dont give me a .guild only a .guildId
cache does not have this guild nor can i fetch it (DiscordAPIError[10004]: Unknown Guild)

low saddleBOT
civic relic
#

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

#

using a different (older) bot clientid/token works

#

as far as i can tell the bot settings are the exact same

errant pumice
#

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?

civic relic
#

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

errant pumice
#

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

civic relic
#

thats what i thought

#

(didnt know getMember was an option)

#

but display* is nowhere to be seen

errant pumice
#

<ChatInputCommandInteraction>.member and getMember would just return raw member data rather than GuildMember objects

civic relic
#

well i did see .nick available but i wanted the convenience of .displayName

#

(incase .nick is nonexistant)

errant pumice
#

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)

civic relic
#

okay

#

thank u for the help

errant pumice
#

👍