Message Delete is not logging to channel when messaged deleted

im trying to make a messge delete log embed but its no errors its just not logging to the channel any reasons why?
const { EmbedBuilder } = require("discord.js");
const { getSettings } = require("@schemas/Guild");

module.exports = async (client, message) => {
if (message.partial) return;
if (message.author.bot || !message.guild) return;

const settings = await getSettings(message.guild);
if (!settings.modlog_channel) return;

const logChannel = message.guild.channels.cache.get(settings.modlog_channel);
if (!logChannel) return;

if (message.content) {
// Log deleted message
const embed = new EmbedBuilder()
.setColor("#FF5733")
.setTitle("Message Deleted")
.addFields(
{ name: "Content", value: message.content },
{ name: "Author", value: `${message.author.tag} (${message.author.id})`, inline: true },
{ name: "Channel", value: message.channel.toString(), inline: true }
)
.setFooter({ text: `Deleted at: ${new Date().toLocaleString()}` });

logChannel.send({ embeds: [embed] });
}
};
const { EmbedBuilder } = require("discord.js");
const { getSettings } = require("@schemas/Guild");

module.exports = async (client, message) => {
if (message.partial) return;
if (message.author.bot || !message.guild) return;

const settings = await getSettings(message.guild);
if (!settings.modlog_channel) return;

const logChannel = message.guild.channels.cache.get(settings.modlog_channel);
if (!logChannel) return;

if (message.content) {
// Log deleted message
const embed = new EmbedBuilder()
.setColor("#FF5733")
.setTitle("Message Deleted")
.addFields(
{ name: "Content", value: message.content },
{ name: "Author", value: `${message.author.tag} (${message.author.id})`, inline: true },
{ name: "Channel", value: message.channel.toString(), inline: true }
)
.setFooter({ text: `Deleted at: ${new Date().toLocaleString()}` });

logChannel.send({ embeds: [embed] });
}
};
2 Replies
d.js toolkit
d.js toolkit8mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
duck
duck8mo ago
if (message.partial) return;
if you don't want to handle partials, you can just not enable the Message partial but that aside, do you have the proper intents? are you sure that the message isn't partial?
Want results from more Discord servers?
Add your server