TypeError
Code:
const guild = bot.guilds.cache.get(process.env.GUILD_ID);
Error:
TypeError: Cannot read properties of undefined (reading 'cache')
11 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- 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-
ReferenceError: "x" is not defined
: learn more
- TypeError: Cannot read properties of undefined/null (reading "x")
: learn moreeven after reading that, it still doesn't do anything, same error
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
bot is defined in my module exports at the top of the file
it works in another file
(with the same setup)
but not this one
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
bot is defined as the client
Unknown User•10mo ago
Message Not Public
Sign In & Join Server To View
<ref *1> Message {
channelId: '1214645737846214676',
guildId: '755968485854675065',
id: '1214716407061946479',
createdTimestamp: 1709681359783,
type: 0,
system: false,
content: 'a',
author: User {
id: '274021702411747328',
bot: false,
system: false,
flags: UserFlagsBitField { bitfield: 4194432 },
username: 'istay',
globalName: 'istay',
discriminator: '0',
avatar: '252101a53000bd59fdf81aee28d96db9',
banner: undefined,
accentColor: undefined,
avatarDecoration: null
},
pinned: false,
tts: false,
nonce: '1214716406403170304',
embeds: [],
components: [],
attachments: Collection(0) [Map] {},
stickers: Collection(0) [Map] {},
position: null,
roleSubscriptionData: null,
resolved: null,
editedTimestamp: null,
reactions: ReactionManager { message: [Circular *1] },
mentions: MessageMentions {
everyone: false,
users: Collection(0) [Map] {},
roles: Collection(0) [Map] {},
_members: null,
_channels: null,
_parsedUsers: null,
crosspostedChannels: Collection(0) [Map] {},
repliedUser: null
},
webhookId: null,
groupActivityApplication: null,
applicationId: null,
activity: null,
flags: MessageFlagsBitField { bitfield: 0 },
reference: null,
interaction: null
}
thats the outputUnknown User•10mo ago
Message Not Public
Sign In & Join Server To View
got it
ill try that