Click here to Skip to main content
15,395,877 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Every time a user send messages a webhook edits its name and shows message.author.username but after After some time maybe because of an error the webhook creates 2 or more webhooks and keeps showing message author names.

How to use only 1 webhook?
let webhook = await client.channels.cache.get(smchannel[i]).fetchWebhooks();
webhook = webhook.find(x => x.name === message.member.nickname ? message.member.nickname : message.author.username);
        
      
webhook = await client.channels.cache.get(smchannel[i]).createWebhook('Chat Guy', {
            
avatar: client.user.displayAvatarURL({ dynamic: true })});
        
        
await webhook.edit({
name: message.member.nickname ? message.member.nickname : message.author.username,
avatar: message.author.displayAvatarURL({ dynamic: true })})

webhook.send( content ).catch(err => { })

    }
});


What I have tried:

I have tried everything but still facing same problem, how to use only 1 webhook?
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900