export const event = 'emojiDelete'

export async function callback(client, emoji) {
    try{
        const { getAuditLog, log, NucleusColors, entry, renderUser, renderDelta, renderEmoji } = emoji.client.logger
        let auditLog = await getAuditLog(emoji.guild, 'EMOJI_DELETE');
        let audit = auditLog.entries.filter(entry => entry.target.id == emoji.id).first();
        if (audit.executor.id == client.user.id) return;
        let data = {
            meta: {
                type: 'emojiDelete',
                displayName: 'Emoji Deleted',
                calculateType: 'emojiUpdate',
                color: NucleusColors.red,
                emoji: "GUILD.EMOJI.DELETE",
                timestamp: audit.createdTimestamp,
            },
            list: {
                id: entry(emoji.id, `\`${emoji.id}\``),
                emoji: entry(emoji.name, renderEmoji(emoji)),
                deletedBy: entry(audit.executor.id, renderUser(audit.executor)),
                created: entry(emoji.createdTimestamp, renderDelta(emoji.createdTimestamp)),
                deleted: entry(audit.createdTimestamp, renderDelta(audit.createdTimestamp)),
            },
            hidden: {
                guild: emoji.guild.id
            }
        }
        log(data, client);
    } catch {}
}
