Search code examples
javascriptnode.jsdiscorddiscord.js

how do I set my bot sending all the logs to a named channel?


let logschannel = message.guild.channels.cache.find(channel =\> channel.name === 'logs');

I want to get my bot to send logs from joining and leaving to deleting a message in a specifically named channel. Can someone help?


Solution

  • You got one wrong code in your given code which is the =\> to do this you need to find first the channel, yes, you do it right. You just need to change =\> to =>.

    Now when you finished changing that all you need to do is to call the logschannel

    let logschannel = message.guild.channels.cache.find(channel => channel.name === 'logs');
    loschannel.send({content: "your content"})
    

    can do with embeds too.

    let logschannel = message.guild.channels.cache.find(channel => channel.name === 'logs');
    logschannel.send({embeds: [your_embed_name]});