Message sending multiple times

Sounds like a really basic issue - and it may be so. However, I've been unable to come up with a solution as to what is exactly causing the issue & how I would resolve it.

You will see from the code attached below that I am attempting to send a welcome message ONCE. If you also look at the attached image, you'll see that there are multiple of these messages being sent at one time.
import { TextChannel } from 'discord.js';
import keys from '../keys';
import { event } from '../utils';
import { CustomEmbeds } from '../config/embeds';

const handled_this_session = new Set();

export default event('guildMemberAdd', async ({ client }, member) => {
    if (!client.user) return;
    if (member.guild.id !== keys.GUILD_ID_MAIN) return;
    if (handled_this_session.has(member.id)) return;

    const welcome_channel = await client.channels.fetch(keys.CHANNEL_ID_WELCOME) as TextChannel;

    const messages = await welcome_channel.messages.fetch()
    const isExisting = messages.filter(msg => { return msg.content.includes(`<@${member.id}>`) });
    if (isExisting.size > 0) return;

    await welcome_channel.send({
        content: member.toString(),
        embeds: [CustomEmbeds.general.welcome_message(member)]
    })

    handled_this_session.add(member.id)
})
image.png
Was this page helpful?