logging: reasons, WEBHOOK_CREATE
This commit is contained in:
parent
71829a58ac
commit
398d9f650a
1 changed files with 54 additions and 1 deletions
|
@ -89,7 +89,6 @@ events.add("guildAuditLogEntryCreate", "logging", async function (entry) {
|
||||||
case AuditLogActions.ROLE_CREATE:
|
case AuditLogActions.ROLE_CREATE:
|
||||||
case AuditLogActions.ROLE_UPDATE:
|
case AuditLogActions.ROLE_UPDATE:
|
||||||
case AuditLogActions.ROLE_DELETE:
|
case AuditLogActions.ROLE_DELETE:
|
||||||
case AuditLogActions.WEBHOOK_CREATE:
|
|
||||||
case AuditLogActions.WEBHOOK_UPDATE:
|
case AuditLogActions.WEBHOOK_UPDATE:
|
||||||
case AuditLogActions.WEBHOOK_DELETE:
|
case AuditLogActions.WEBHOOK_DELETE:
|
||||||
case AuditLogActions.INVITE_CREATE:
|
case AuditLogActions.INVITE_CREATE:
|
||||||
|
@ -170,6 +169,10 @@ events.add("guildAuditLogEntryCreate", "logging", async function (entry) {
|
||||||
value: removed.map((role) => `<@&${role.id}> (${role.name})`).join("\n"),
|
value: removed.map((role) => `<@&${role.id}> (${role.name})`).join("\n"),
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
|
entry.reason != null && {
|
||||||
|
name: "Reason",
|
||||||
|
value: `\`${entry.reason.replaceAll("`", "\u02cb")}\``,
|
||||||
|
},
|
||||||
].filter((x) => !!x),
|
].filter((x) => !!x),
|
||||||
footer: {
|
footer: {
|
||||||
text: `Role ID${plural}: ${roles.map((role) => role.id).join(", ")}`,
|
text: `Role ID${plural}: ${roles.map((role) => role.id).join(", ")}`,
|
||||||
|
@ -180,6 +183,44 @@ events.add("guildAuditLogEntryCreate", "logging", async function (entry) {
|
||||||
.catch(() => {});
|
.catch(() => {});
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
case AuditLogActions.WEBHOOK_CREATE: {
|
||||||
|
channel
|
||||||
|
.createMessage({
|
||||||
|
embeds: [
|
||||||
|
{
|
||||||
|
color: COLOR_ADDED,
|
||||||
|
title: `${entry.after.application_id != null ? "Application " : ""}Webhook Created`,
|
||||||
|
description: `<@${entry.user.id}> (${formatUsername(
|
||||||
|
entry.user
|
||||||
|
)}) created webhook \`${entry.after.name.replaceAll("`", "\u02cb")}\` in <#${
|
||||||
|
entry.after.channel_id
|
||||||
|
}> (${entry.guild.channels.get(entry.after.channel_id)?.name ?? "<uncached>"})`,
|
||||||
|
fields: [
|
||||||
|
entry.after.application_id != null && {
|
||||||
|
name: "Application ID",
|
||||||
|
value: entry.after.application_id,
|
||||||
|
inline: true,
|
||||||
|
},
|
||||||
|
entry.reason != null && {
|
||||||
|
name: "Reason",
|
||||||
|
value: `\`${entry.reason.replaceAll("`", "\u02cb")}\``,
|
||||||
|
},
|
||||||
|
].filter((x) => !!x),
|
||||||
|
footer: {
|
||||||
|
text: `Webhook ID: ${entry.targetID}`,
|
||||||
|
},
|
||||||
|
thumbnail:
|
||||||
|
entry.after.avatar_hash != null
|
||||||
|
? {
|
||||||
|
url: `https://cdn.discordapp.com/avatars/${entry.targetID}/${entry.after.avatar_hash}.png?size=4096`,
|
||||||
|
}
|
||||||
|
: null,
|
||||||
|
},
|
||||||
|
],
|
||||||
|
})
|
||||||
|
.catch(() => {});
|
||||||
|
break;
|
||||||
|
}
|
||||||
case AuditLogActions.THREAD_CREATE: {
|
case AuditLogActions.THREAD_CREATE: {
|
||||||
channel
|
channel
|
||||||
.createMessage({
|
.createMessage({
|
||||||
|
@ -202,6 +243,10 @@ events.add("guildAuditLogEntryCreate", "logging", async function (entry) {
|
||||||
})`,
|
})`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
|
entry.reason != null && {
|
||||||
|
name: "Reason",
|
||||||
|
value: `\`${entry.reason.replaceAll("`", "\u02cb")}\``,
|
||||||
|
},
|
||||||
].filter((x) => !!x),
|
].filter((x) => !!x),
|
||||||
footer: {
|
footer: {
|
||||||
text: `Thread ID: ${entry.targetID}`,
|
text: `Thread ID: ${entry.targetID}`,
|
||||||
|
@ -298,6 +343,10 @@ events.add("guildAuditLogEntryCreate", "logging", async function (entry) {
|
||||||
value: tagDiff,
|
value: tagDiff,
|
||||||
inline: false,
|
inline: false,
|
||||||
},
|
},
|
||||||
|
entry.reason != null && {
|
||||||
|
name: "Reason",
|
||||||
|
value: `\`${entry.reason.replaceAll("`", "\u02cb")}\``,
|
||||||
|
},
|
||||||
].filter((x) => !!x),
|
].filter((x) => !!x),
|
||||||
footer: {
|
footer: {
|
||||||
text: `Thread ID: ${entry.targetID}`,
|
text: `Thread ID: ${entry.targetID}`,
|
||||||
|
@ -330,6 +379,10 @@ events.add("guildAuditLogEntryCreate", "logging", async function (entry) {
|
||||||
})`,
|
})`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
|
entry.reason != null && {
|
||||||
|
name: "Reason",
|
||||||
|
value: `\`${entry.reason.replaceAll("`", "\u02cb")}\``,
|
||||||
|
},
|
||||||
].filter((x) => !!x),
|
].filter((x) => !!x),
|
||||||
footer: {
|
footer: {
|
||||||
text: `Thread ID: ${entry.targetID}`,
|
text: `Thread ID: ${entry.targetID}`,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue