#message.authorId is never defined

1 messages · Page 1 of 1 (latest)

pearl condor
#
events.messageCreate = (m: DDeno.Message) => console.log(m.authorId);

this always logs undefined
i swear it used to work before updating to 17.1.0
is there a change i forgot?

#

(using bigbot template btw)

sour ruin
bold summit
#

Do your events this way for better type safety

events.messageCreate: EventHandlers['messageCreate'] = (m: DDeno.Message) => {

@pearl condor

#

It should error there ^

#
  • you wouldn't need to set the type
#

This'll work

#
events.messageCreate: EventHandlers['messageCreate'] = (bot, m) => {

and they'll have the types

pearl condor
#

hm, i wonder how it worked before

#

thank you

bold summit
pearl condor
#

ye

bold summit
#

hm actually you wouldn't need that thonkwoke

#

it should work by itself already and should error without EventHandlers['messageCreate'] type since it already have that type

#

I use that in my functions cuz mine is a run function that doesn't have the types but in this case it should already have the types and should error theoretically

pearl condor
#

mine dont have auto typing either

#

cuz im exporting the events to imported files

bold summit
#

ah events is a separate thing

#

i thought events is from bot.events

#

then yea it wont have typings and using EventHandlers['messageCreate'] is suggested