#member object is undefined
1 messages · Page 1 of 1 (latest)
hi
In the bot portal?
as in all intents or just the ones i mentioned before
Nah in your code
const client = new Client({ intents: ['GUILDS', 'GUILD_MEMBERS', 'GUILD_MESSAGES', 'GUILD_VOICE_STATES'] });
Add message too
const client = new Client({ intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES, ['GUILDS', 'GUILD_MEMBERS'] , ['GUILD_VOICE_STATES']] });
true
Thats not how an array works
Try this one
so i need add this one?
Ya
replace yours with that
there
[Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES is not working anymore?
Still not working-
replace everything with this
just did and not working
show code
module.exports = {
name: 'messageCreate',
execute(message) {
if (message.channel.type === 'DM') return;
if(message.member.permissions.has("ADMINISTRATOR")) return;```
I saw his code and he is using files for event
ah
@rancid crescent are you are loading file for event handling in client?
no
I guess you are doing client, ..args
mhm
const discord = require('discord.js');
module.exports = {
name: 'messageCreate',
execute(client, message) {
if (message.channel.type === 'DM') return;
if(message.member.permissions.has("ADMINISTRATOR")) return;```
Try this
I think this will work if am I right 😂
nope
It wont
was bouta ask where he's parsing in these values
bot still warning me
Umh
well let's try this
Can you share code of main file where you are loading all the events
^
the event handler right?
Ya
for (const file of eventFiles) {
const event = require(`./events/${file}`);
if (event.once) {
client.once(event.name, (...args) => event.execute(...args, client));
} else {
client.on(event.name, (...args) => event.execute(...args, client));
}
}```
@rancid crescent do you have GUILD_MESSAGES intent in the dev portal?
lemme see
...args, client O_o
Isn't that optional?
member?** | partial guild member object | member properties for this message's author```
yes
Not to get information about the message
Log message
alr
*message
Oh wait messages, i thought members
If I'm not mistaken, shouldn't he just switch ...args, client to client, ...args?
No
Nothing.
Order doesnt matter, they had it correctly
Wdym nothing?
The log isnt showing in the console.
Did you log message?
I think the bot ignoring the line.
Yes-
Code?
module.exports = {
name: 'messageCreate',
execute(message) {
if (message.channel.type === 'DM') return;
if(message.member.permissions.has("ADMINISTRATOR")) return;
console.log(message)
```
just send the lot (token removed)
Log it before that line...
Umh log that after execute
\
its too long to be send-
Give us starting line of it
Send it in a bin
My TS acting up or nah
^
TypeError: Cannot read properties of undefined (reading 'type')```
getting this now-
What did you change now?
channelId: '',
guildId: '',
id: '',
createdTimestamp: ,
type: 'DEFAULT',
system: false,
content: 'discord.gg/123',
author: User {
id: '',
bot: false,
system: false,
flags: UserFlags { bitfield: 256 },
username: '-',
discriminator: '9037',
avatar: 'c688fec350ce6a7a02518403071ef451',
banner: undefined,
accentColor: undefined
},
pinned: false,
tts: false,```
You just had to add a console.log here
Why you are getting everything null
module.exports = {
name: 'messageCreate',
execute(message) {
console.log(message)
if (message.channel.type === 'DM') return;
if(message.member.permissions.has("ADMINISTRATOR")) return;```
Ok can someone please just address this, because I got this working fine in mine with the rest parameter as the last parameter, not the first
will the code is working, only the if(message.member.permissions.has("ADMINISTRATOR")) return; is not.
Nah you are not getting ids
Send the whole log in a pastebin
its working with the other commands, (kick, ban etc...)
You can also try this @rancid crescent
Thank you
to change the event handler?
@vestal comet but check this
He is not getting any ids
I already did
Umh ;~;
const eventFiles = fs.readdirSync('./events').filter(file => file.endsWith('.js'));
for (const file of eventFiles) {
const event = require(`./events/${file}`);
if (event.once) {
client.once(event.name, (...args) => event.execute(client, ...args));
} else {
client.on(event.name, (...args) => event.execute(client, ...args));
}
}
k lemme try
wait
const discord = require('discord.js');
module.exports = {
name: 'messageCreate',
execute(_client, message) {
console.log(message)
if (message.channel.type === 'DM') return;
if(message.member.permissions.has("ADMINISTRATOR")) return;
k
try those
still nothing
for some reasons- im getting this error: ``` if (message.channel.type === 'dm') return;
^
TypeError: Cannot read properties of undefined (reading 'type')```
messageCreate doesn't fire in DMs btw
Log the message and copy and paste in this website
oh so its not needed?
It does wdym
it doesn't?
It does
But it is not getting channel type
It will with dm intent
Right, yep ignore me I forgot about the DM intent
veuillez m’excuser
@rancid crescent this is being short of caos.
1.- Did you change both files?
2.- Can you show the whole output of message in a pastebin?
Ain't think like the 10th time we've attempted the pastebin route
I think he is hiding the details
thank u all
Hw
@rancid crescent ^^^
My menial brain requires knowledge that does not affect me in the slightest due to curiosity, but fed it must be
uhm just changed something
He is gone without telling us the solution
i bet he leaves his bins by the side of the road
idk, you seem like the kinda guy to close the fridge with your hips. getting that vibe
O_o
huh ty ig?
just a hunch :)
:D
I can't delete this thread