Search code examples
node.jsdiscordbots

Discord bot won't trigger off of a specific user anymore


I have found a unique situation with my discord bot. I have it set to have a welcome canvas when someone joins and to respond to specific lines when people say stuff.

For some reason it won't respond to one user and I can't figure out why. It will respond to anyone else. I even had the user leave and rejoin the server and it wouldn't display the welcome message for that user too. The user is completely invisible to the bot.

My bot has too much code to post but if you have specific questions about any functions I can post those.

Here is the message create function. There is too much to show for this function as it has a leveling/xp system alongside interactions with specific messages.

    //bot tasks when someone sends a message
client.on('messageCreate', (msg) => {
    if (msg.author.id == client.user.id){
        return;
    }

Client is the bots ID

Here is the welcome message function

    //welcome message 
client.on('guildMemberAdd', async (member) => {
    const img = await generateImage(member);
    const welcomeMessage = '<@' + member.user.id + '>  welcome to my cul-, I mean club!';
    const channel = member.guild.channels.cache.find(i => i.name === 'welcome');
    channel.send({
        content: welcomeMessage,
        files: [img]
        });
}); //end welcome message

Solution

  • Hello I found the error and solved it.

    It turns out it was due to me setting an embed fields to null instead of []. So when the bot was trying to respond with an embed it would return from the messageSend function.