#Guild.id = null
1 messages · Page 1 of 1 (latest)
intents all enabled
<ref *1> Message {
channelId: '930764031457890344',
guildId: '929999778073432155',
id: '953992119356379146',
createdTimestamp: 1647519845571,
type: 'DEFAULT',
system: false,
content: 'c',
author: User {
id: '929967642138271825',
bot: false,
system: false,
flags: UserFlags { bitfield: 256 },
username: 'ᴄ ʜ ᴏ ɴ ɢ',
discriminator: '6672',
avatar: 'a3e24eaf58c98c8264b8effe55054164',
banner: undefined,
accentColor: undefined
},
pinned: false,
tts: false,
nonce: '953992114117541888',
embeds: [],
components: [],
attachments: Collection(0) [Map] {},
stickers: Collection(0) [Map] {},
editedTimestamp: null,
reactions: ReactionManager { message: [Circular *1] },
mentions: MessageMentions {
everyone: false,
users: Collection(0) [Map] {},
roles: Collection(0) [Map] {},
_members: null,
_channels: null,
crosspostedChannels: Collection(0) [Map] {},
repliedUser: null
},
webhookId: null,
groupActivityApplication: null,
applicationId: null,
activity: null,
flags: MessageFlags { bitfield: 0 },
reference: null,
interaction: null
}```
Show the code how you defined the guild
msg = Message<boolean>
message.guild dude
try to log the cache of the guilds
client.guilds.cache
but
there is no idea it can register slash cmd
in a guild
cuz it is registering the slash cmd to my guild only
it doesnt have any errs
it can register the slash cmd in the guild
okay and?
cached the guild?
it doesnt have any err
cache of the guild should be always valid, if you did not changed some settings
but the thing is I need the guild.id
not caching it
okay, guildId is there for you,
so do you mean that u changed the cache settings?
no
apparently that command you gave isn't slash command
no dude
others work fine
slash cmd
okay, slash commands works fine as expected, but message commands don't?
no
is timeout slash cmd dont works
others ok
what is this code for?
when I run then it will be err
that is not a slash command
that is messageCreate event
it doesnt affect
guild.id still null
that is finding the db
said you got guildId instead,
?
msg.guildId
TypeError: Cannot read properties of null (reading 'id')
at ex_client.<anonymous> (D:\Discord-TS-Bot (v13)\src\events\anti_spam.ts:14:20)
at ex_client.emit (node:events:402:35)
at MessageCreateAction.handle (D:\Discord-TS-Bot (v13)\node_modules\discord.js\src\client\actions\MessageCreate.js:26:14)
at Object.module.exports (D:\Discord-TS-Bot (v13)\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_CREATE.js:4:32)
at WebSocketManager.handlePacket (D:\Discord-TS-Bot (v13)\node_modules\discord.js\src\client\websocket\WebSocketManager.js:351:31)
at WebSocketShard.onPacket (D:\Discord-TS-Bot (v13)\node_modules\discord.js\src\client\websocket\WebSocketShard.js:444:22)
at WebSocketShard.onMessage (D:\Discord-TS-Bot (v13)\node_modules\discord.js\src\client\websocket\WebSocketShard.js:301:10)
at WebSocket.onMessage (D:\Discord-TS-Bot (v13)\node_modules\ws\lib\event-target.js:199:18)
at WebSocket.emit (node:events:390:28)
at Receiver.receiverOnMessage (D:\Discord-TS-Bot (v13)\node_modules\ws\lib\websocket.js:1137:20)
[ERROR] 20:37:09 TypeError: Cannot read properties of null (reading 'id')```
see 14 line
guild is not cached somehow, that's the reason.
so I need to cache the guild.id?
Ik it doesnt cached sometimes
djs get the guild from the cache, if the guild is not cached(by intents ... etc), gives you null.
imma try
cache it first then
oh it works
but the thing is why sometimes...
ping others cmd works
anti_spam this event watches every msg

ok
imma close this thread then
@icy beacon
still dont works
after running once again
cached it
ahhhhhhhhhhh

1
1? wtf
still have no idea why it is not cached,
ahhhh
hmm why don't you try what i said earlier?
console.log(client.guilds.cache) in ready event.
what?
?
ok
then
<ref *2> Guild {
id: '929999778073432155',
name: 'ᴄ ʜ ᴏ ɴ ɢ <{}>',
icon: '52a6deb236cb4461ed1c806472504fc0',
features: [],
commands: <ref *1>
}```
I deleted after the log
since too long
but it is still a GUILDDDDD
u did this, and that came out?
do you have your own guilds property on client?
notice the difference between this and what you just sent to me
that's just a plain Guild object, not a collection, which seems abnormal
cached the guild id and console log it
so how did you cache the guild?
did you do anything with client.guilds.cache?
just client.guilds.cache.get(guild.id)
so....................... u did not do console.log(client.guilds.cache)
same thing
i bet it is not
nah
so it is not same thing
so your cache is fine
do you have the issue even after the bot is ready?
no
after running timeout slash cmd
no