This is my code
bot.on("guildMemberRemove", async (member) => {
const tlog = await member.guild.fetchAuditLogs({
limit: 1,
type: "MEMBER_KICK",
});
const klog = tlog.entries.first();
const { executor, target } = klog;
const rs = tlog.entries.first().reason;
const emb = new Discord.MessageEmbed()
.setTitle("Új KICK!") //New Kick Title
.addField("Kickelt neve", target.user) //The kicked member name
.addField("Kickelő neve", executor) //The member who kicked the other member
.addField("Indok", rs) //Reason
.setTimestamp()
.setColor(15158332)
addToLog(emb);
})
addToLog Function
const channell = "792743591017316413"; //Channel id
function addToLog(message){
const szoba = bot.channels.cache.get(channell); //szoba means room
return szoba.send(message);
};
I looked more websites for the solution, but I completely copy the code and nothing happens.