kamulek
kamulek
DIAdiscord.js - Imagine an app
Created by kamulek on 10/10/2023 in #djs-questions
How Can I make something like this?
I prefer the cheapest way, but.. I don't known how to catch properly event of channel Owerwriting. What should I do?
8 replies
DIAdiscord.js - Imagine an app
Created by kamulek on 10/10/2023 in #djs-questions
How Can I make something like this?
Hm.. Okay, how can I solve this in the simplest way? I'm sorry, but I am beginner and i use AI (like bard or chatgpt) to help, so this explains why some properties don't exist
8 replies
DIAdiscord.js - Imagine an app
Created by kamulek on 10/10/2023 in #djs-questions
How Can I make something like this?
So i use fetchAuditLogs to send a message in embed, which will contain a Moderator mention (the person who edited it)
8 replies
DIAdiscord.js - Imagine an app
Created by kamulek on 10/10/2023 in #djs-questions
How Can I make something like this?
Hey! So i like do something like this:
client.on(Events.ChannelUpdate, async (oldChannel, newChannel) => {
const channel = client.channels.cache.get(logsChannel);
if (!channel) return;

const createOverwriteChannelAuditLog = await newChannel.guild.fetchAuditLogs({ limit: 1, type: AuditLogEvent.ChannelOverwriteCreate });
const updateOverwriteChannelAuditLog = await newChannel.guild.fetchAuditLogs({ limit: 1, type: AuditLogEvent.ChannelOverwriteUpdate });
const deleteOverwriteChannelAuditLog = await newChannel.guild.fetchAuditLogs({ limit: 1, type: AuditLogEvent.ChannelOverwriteDelete });

const createEntry = createOverwriteChannelAuditLog.entries.first();
const updateEntry = updateOverwriteChannelAuditLog.entries.first();
const deleteEntry = deleteOverwriteChannelAuditLog.entries.first();

const message = new EmbedBuilder()
.setTitle('Channel Update')
.setDescription(`**Channel name changed from ${oldChannel.name} to ${newChannel.name}`)
.setColor('Green')
if (createEntry) {
const message = new EmbedBuilder()
.setTitle('Channel permission override created')
.setDescription(`**Event Type:** ${createEntry.action} **Channel:** ${oldChannel.name} **Role or user:** ${createEntry.target} **New permissions:** ${PermissionsBitField.Flags.createEntry.overwrite.permissions} **Moderator:** ${createEntry.executor.toString()}`)
.setColor('Green');
channel.send(message);
}

if (updateEntry) {
const message = new EmbedBuilder()
.setTitle('Channel permission override updated')
.setDescription(`**Event Type:** ${updateEntry.action} **Channel:** ${oldChannel.name} **Role or user:** ${updateEntry.target} **Old permissions:** ${Permissions.FLAGS[updateEntry.overwrite.old_permissions]} **New permissions:** ${Permissions.FLAGS[updateEntry.overwrite.permissions]} **Moderator:** ${updateEntry.executor.toString()}`)
.setColor('Yellow');
channel.send(message);
}

if (deleteEntry) {
const message = new EmbedBuilder()
.setTitle('Channel permission override removed')
.setDescription(`**Event Type:** ${deleteEntry.action} **Channel:** ${oldChannel.name} **Role or user:** ${deleteEntry.target} **Moderator:** ${deleteEntry.executor.toString()}`)
.setColor('Red');
channel.send(message);
}
});
client.on(Events.ChannelUpdate, async (oldChannel, newChannel) => {
const channel = client.channels.cache.get(logsChannel);
if (!channel) return;

const createOverwriteChannelAuditLog = await newChannel.guild.fetchAuditLogs({ limit: 1, type: AuditLogEvent.ChannelOverwriteCreate });
const updateOverwriteChannelAuditLog = await newChannel.guild.fetchAuditLogs({ limit: 1, type: AuditLogEvent.ChannelOverwriteUpdate });
const deleteOverwriteChannelAuditLog = await newChannel.guild.fetchAuditLogs({ limit: 1, type: AuditLogEvent.ChannelOverwriteDelete });

const createEntry = createOverwriteChannelAuditLog.entries.first();
const updateEntry = updateOverwriteChannelAuditLog.entries.first();
const deleteEntry = deleteOverwriteChannelAuditLog.entries.first();

const message = new EmbedBuilder()
.setTitle('Channel Update')
.setDescription(`**Channel name changed from ${oldChannel.name} to ${newChannel.name}`)
.setColor('Green')
if (createEntry) {
const message = new EmbedBuilder()
.setTitle('Channel permission override created')
.setDescription(`**Event Type:** ${createEntry.action} **Channel:** ${oldChannel.name} **Role or user:** ${createEntry.target} **New permissions:** ${PermissionsBitField.Flags.createEntry.overwrite.permissions} **Moderator:** ${createEntry.executor.toString()}`)
.setColor('Green');
channel.send(message);
}

if (updateEntry) {
const message = new EmbedBuilder()
.setTitle('Channel permission override updated')
.setDescription(`**Event Type:** ${updateEntry.action} **Channel:** ${oldChannel.name} **Role or user:** ${updateEntry.target} **Old permissions:** ${Permissions.FLAGS[updateEntry.overwrite.old_permissions]} **New permissions:** ${Permissions.FLAGS[updateEntry.overwrite.permissions]} **Moderator:** ${updateEntry.executor.toString()}`)
.setColor('Yellow');
channel.send(message);
}

if (deleteEntry) {
const message = new EmbedBuilder()
.setTitle('Channel permission override removed')
.setDescription(`**Event Type:** ${deleteEntry.action} **Channel:** ${oldChannel.name} **Role or user:** ${deleteEntry.target} **Moderator:** ${deleteEntry.executor.toString()}`)
.setColor('Red');
channel.send(message);
}
});
8 replies
DIAdiscord.js - Imagine an app
Created by kamulek on 10/10/2023 in #djs-questions
How Can I make something like this?
And is this correct?
client.on(Events.ChannelUpdate, async (oldChannel, newChannel) => {
const channel = await client.channels.fetch(logsChannel);
if (!channel) return;

const createOverwriteChannelAuditLog = await newChannel.guild.fetchAuditLogs({ limit: 1, type: AuditLogEvent.ChannelOverwriteCreate});
const updateOverwriteChannelAuditLog = await newChannel.guild.fetchAuditLogs({ limit: 1, type: AuditLogEvent.ChannelOverwriteUpdate});
const deleteOverwriteChannelAuditLog = await newChannel.guild.fetchAuditLogs({ limit: 1, type: AuditLogEvent.ChannelOverwriteDelete});

const createEntry = createOverwriteChannelAuditLog.entries.first();
const updateEntry = updateOverwriteChannelAuditLog.entries.first();
const deleteEntry = deleteOverwriteChannelAuditLog.entries.first();
});
client.on(Events.ChannelUpdate, async (oldChannel, newChannel) => {
const channel = await client.channels.fetch(logsChannel);
if (!channel) return;

const createOverwriteChannelAuditLog = await newChannel.guild.fetchAuditLogs({ limit: 1, type: AuditLogEvent.ChannelOverwriteCreate});
const updateOverwriteChannelAuditLog = await newChannel.guild.fetchAuditLogs({ limit: 1, type: AuditLogEvent.ChannelOverwriteUpdate});
const deleteOverwriteChannelAuditLog = await newChannel.guild.fetchAuditLogs({ limit: 1, type: AuditLogEvent.ChannelOverwriteDelete});

const createEntry = createOverwriteChannelAuditLog.entries.first();
const updateEntry = updateOverwriteChannelAuditLog.entries.first();
const deleteEntry = deleteOverwriteChannelAuditLog.entries.first();
});
8 replies