Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
4.5k views
in Technique[技术] by (71.8m points)

discord.js - Discord JS - Get who deletes a message

my bot sends an embed in a room when a message is deleted. The problem is that my bot is able to delete messages When I perform * clear ID, the bot notifies it too. I would like it to send the message only when someone else deletes it


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
const Discord = require('discord.js')

module.exports = (bot, oldMe, newMe, message) => {
    const embed = new Discord.MessageEmbed()
        .setColor(newMe.displayHexColor)
        .setTitle(`Update Member : Les Prios du Lycée`)
        .setDescription(`${newMe} a été modifié !`)
    if (oldMe.nickname != newMe.nickname) {
        embed.addField("Modification du pseudo", `**${oldMe.nickname}** → **${newMe.nickname}**`, false)
    }
    // if (oldMe.avatar != newMe.avatar) {
    //     embed.setImage(newMe.user.displayAvatarURL({ dynamic: true }))
    // }
    if (oldMe.user.discriminator != newMe.user.discriminator) {
        embed.addField("Modification du discriminant", `**${oldMe.user.discriminator}** → **${newMe.user.discriminator}**`, false)
    }
    if (oldMe.user.username != newMe.user.username) {
        embed.addField("Modification du nom d'utilisateur", `**${oldMe.user.username}** → **${newMe.user.username}**`, false)
    }
    if (embed.fields.length > 0) { botlog.send(embed) }
};

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...