Send message to user when their channel gets deleted

This commit is contained in:
Lukas | AstroGD 2022-11-29 19:22:11 +01:00
parent eccb379b51
commit dbb64baae3
Signed by: AstroGD
GPG Key ID: 82A5E6C236C535AA
2 changed files with 16 additions and 2 deletions

View File

@ -3,7 +3,7 @@ import { AuditLogEvent, Events, GuildAuditLogsEntry, PermissionFlagsBits, User }
import { getGuildSetting } from "../tools/data";
import { Badword, database } from "../data";
import { IsNull } from "typeorm";
import getDefaultEmbed, { getFailedEmbed } from "../tools/defaultEmbeds";
import getDefaultEmbed, { getFailedEmbed, getUserReportEmbed } from "../tools/defaultEmbeds";
import { getGuildChannel } from "../tools/discord";
import { Color, Emoji } from "../tools/design";
@ -89,6 +89,13 @@ client.on(Events.ChannelCreate, async (newChannel) => {
return;
}
if (responsibleUser) {
const embed = getUserReportEmbed(guild.name, newChannel.name);
responsibleUser.send({
embeds: [embed]
}).catch(() => {});
}
if (!logChannel || !logChannel.isTextBased()) return;
const embed = getDefaultEmbed();
embed.setTitle(`${Emoji.SECURITY_CHALLENGE_FAILED} Blocked word detected`);

View File

@ -3,7 +3,7 @@ import { AuditLogEvent, Events, GuildAuditLogsEntry, PermissionFlagsBits, User }
import { getGuildSetting } from "../tools/data";
import { Badword, database } from "../data";
import { IsNull } from "typeorm";
import getDefaultEmbed, { getFailedEmbed } from "../tools/defaultEmbeds";
import getDefaultEmbed, { getFailedEmbed, getUserReportEmbed } from "../tools/defaultEmbeds";
import { getGuildChannel } from "../tools/discord";
import { Color, Emoji } from "../tools/design";
@ -89,6 +89,13 @@ client.on(Events.ChannelUpdate, async (oldChannel, newChannel) => {
return;
}
if (responsibleUser) {
const embed = getUserReportEmbed(guild.name, newChannel.name);
responsibleUser.send({
embeds: [embed]
}).catch(() => {});
}
if (!logChannel || !logChannel.isTextBased()) return;
const embed = getDefaultEmbed();
embed.setTitle(`${Emoji.SECURITY_CHALLENGE_FAILED} Blocked word detected`);