#Missing Member in messages
1 messages · Page 1 of 1 (latest)
can you show the code?
it shouldnt be undefined, it should be null if it doesnt exist
are you resolving the promise?
resolving the promise @grim geyser?
yes, fetching returns a promise, you are probably getting partial data if you are not resolving the promise
await will work yes
let targets = await messages.filter(m => m.author.id != client.user.id);```
Like so in an await function?
Like that, but in an await function
you need to await when you fetch, not filter
and yeah it needs to be in async function (unless you are using esm with top level await)
gotcha
Same thing
setInterval(async () => {
let messages = await client.guilds.get('185590609631903755').channels.get('872955650982948904').fetchMessages({limit: 100});
let targets = messages.filter(m => m.author.id != client.user.id);
targets.forEach(async m => {
if (m.member) {
console.log('Member: ' + m.member.displayName);
} else {
console.log('N o Member');
}
if (m.member.roles.has(client.blender.memberRole)) return m.delete();
if (m.content.toLowerCase().includes(client.blender.password.toLowerCase())) {
m.member.addRole(client.blender.memberRole);
m.delete();
}
});
}, 5000);```
fetchMessages isnt v13, i cant provide help with older versions as im not familiar with them and/or any shortcomings they might have
in v13, its await <TextChannel>.messages.fetch({ limit: 100 })