#Guild.id = null

1 messages · Page 1 of 1 (latest)

sage barn
#

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
}```
untold cape
#

Show the code how you defined the guild

sage barn
#

msg = Message<boolean>

sage barn
icy beacon
#

try to log the cache of the guilds

sage barn
#

oh

icy beacon
#

client.guilds.cache

sage barn
#

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

icy beacon
#

i dont get your word

#

wdym

sage barn
#

it can register the slash cmd in the guild

icy beacon
#

okay and?

sage barn
#

I cached it

#

while registering

icy beacon
#

cached the guild?

sage barn
#

it doesnt have any err

sage barn
#

no err on tis

icy beacon
#

cache of the guild should be always valid, if you did not changed some settings

sage barn
#

not caching it

icy beacon
#

okay, guildId is there for you,
so do you mean that u changed the cache settings?

sage barn
#

I found that

#

only timeout cmd

#

got problem

#

and others slash cmd dont have issue

icy beacon
#

apparently that command you gave isn't slash command

sage barn
#

others work fine

#

slash cmd

icy beacon
#

okay, slash commands works fine as expected, but message commands don't?

sage barn
#

is timeout slash cmd dont works

#

others ok

icy beacon
#

what is this code for?

sage barn
icy beacon
#

that is not a slash command

sage barn
#

it doesnt affect

sage barn
icy beacon
#

said you got guildId instead,

sage barn
icy beacon
#

msg.guildId

sage barn
#
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')```
sage barn
icy beacon
sage barn
#

it comes from 14 line

icy beacon
#

guild is not cached somehow, that's the reason.

sage barn
#

Ik it doesnt cached sometimes

icy beacon
#

djs get the guild from the cache, if the guild is not cached(by intents ... etc), gives you null.

sage barn
#

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

icy beacon
#

so the cache is to blame...

#

how many guilds do your bot have?

#

approximately?

sage barn
icy beacon
#

1? wtf

sage barn
#

since it is still dev

#

every cmd got 200 lines dude

icy beacon
#

still have no idea why it is not cached,

sage barn
#

ahhhh

icy beacon
#

hmm why don't you try what i said earlier?

#

console.log(client.guilds.cache) in ready event.

sage barn
sage barn
#

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

icy beacon
sage barn
#

Idk why it is undefneddd

#

null*

icy beacon
#

do you have your own guilds property on client?

icy beacon
#

notice the difference between this and what you just sent to me

icy beacon
sage barn
icy beacon
#

did you do anything with client.guilds.cache?

sage barn
icy beacon
#

so....................... u did not do console.log(client.guilds.cache)

sage barn
#

now doing

icy beacon
#

i bet it is not

sage barn
icy beacon
#

so it is not same thing

#

so your cache is fine

#

do you have the issue even after the bot is ready?

sage barn
#

no

icy beacon
#

then before the ready event?

#

when you are having trouble?

sage barn
#

after running timeout slash cmd

icy beacon
#

does not help

#

do you have trouble only before ready event?

sage barn
#

no

icy beacon
#

so messageCreate event works as you expected before you are using timeout command,

#

but after you are using timeout command, the issue comes out?

sage barn
#

wait

#

I just logged my db data

#

and the gid is null

#

fine I go ask others server since this err is not djs already