shard.broadcastEval gives me a reference error even tho all vars are defined
So I just sharded my bot and was playing around with
client.broadcastEval
and it gives me this.
got a channelCreate.js event file like so:
and it gives this error when a channel is created
but it logs the guild name before crashing... also after the bot crashes it restarts itself automatically and thats weird cuz i dont have no such thing set up40 Replies
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
but it happens only during that event
and i have only one channelCreate listener
do u need my shard.js file ?
i dont understand sorry... how do i do a project wide search
vs code
ctrl + f ??
@qjuh sorry i slept
no
well this is my event handler
yes i save after every line 💀
ok so the error is not arising from the event file
that is the error it throws after logging the whole client object for some reason and then runs the bot again with the main file (index.js)
it appears to be arising from here
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
so i use the context object to pass in more properties that i need? like channelId or reply and stuff for example ?
that actually makes total sense tysm!!
oh btw... if i like define something outside the function... like
let me = "bot"
will it be accessible or do i need to { context: { text: me } }
alright ty !!it works if i do this... but I cant pass in the whole message object ?
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
oh... so i need to import the class directly
inside the function
but like... i was able to pass
message.author
but not message
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
so i'll have to fetch the message using the id inside the function
fetch the channel*
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
oh no reason... i'm sharding my bot before making it public... so i dont have problem if it's good... so im just learning and testing using shards to get used to it
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
ouu
got it
so i can just use the usual code...
but in any case suppose i need to fetch the channel using id... then i'll have to use broadcastEval
right ??
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
cuz im storing a log channel id in a database
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
but how would i know if the guild belongs to that shard
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
OH I SEE
so i dont need to use broadcastEval in my cmds
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
only in case i am not getting it by normal method then i'll use broadcastEval ?? right
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
nothing sorry my bad...
but if i want to do some stuff on another guild or channel
i'll do something like that right
the second part
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
alright tysm!
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
like that ig
Unknown User•2y ago
Message Not Public
Sign In & Join Server To View
alright tysm