few changes
diff --git a/src/events/channelDelete.ts b/src/events/channelDelete.ts
index ac29238..e8c888a 100644
--- a/src/events/channelDelete.ts
+++ b/src/events/channelDelete.ts
@@ -3,69 +3,71 @@
export const event = 'channelDelete'
export async function callback(client, channel) {
- const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser } = channel.client.logger
+ try{
+ const { getAuditLog, log, NucleusColors, entry, renderDelta, renderUser } = channel.client.logger
- let auditLog = await getAuditLog(channel.guild, 'CHANNEL_DELETE');
- let audit = auditLog.entries.filter(entry => entry.target.id == channel.id).first();
- if (audit.executor.id == client.user.id) return;
+ let auditLog = await getAuditLog(channel.guild, 'CHANNEL_DELETE');
+ let audit = auditLog.entries.filter(entry => entry.target.id == channel.id).first();
+ if (audit.executor.id == client.user.id) return;
- let emoji;
- let readableType;
- let displayName;
- switch (channel.type) {
- case 'GUILD_TEXT': {
- emoji = "CHANNEL.TEXT.DELETE";
- readableType = "Text";
- displayName = "Text Channel"
- break;
- }
- case 'GUILD_VOICE': {
- emoji = "CHANNEL.VOICE.DELETE";
- readableType = "Voice";
- displayName = "Voice Channel"
- break;
- }
- case 'GUILD_CATEGORY': {
- emoji = "CHANNEL.CATEGORY.DELETE";
- readableType = "Category";
- displayName = "Category"
- break;
- }
- default: {
- emoji = "CHANNEL.TEXT.DELETE";
- readableType = "Channel";
- displayName = "Channel"
- }
- }
- let list = {
- id: entry(channel.id, `\`${channel.id}\``),
- name: entry(channel.id, `${channel.name}`),
- topic: null,
- type: entry(channel.type, readableType),
- category: entry(channel.parent ? channel.parent.id : null, channel.parent ? channel.parent.name : "Uncategorised"),
- nsfw: null,
- created: entry(channel.createdTimestamp, renderDelta(channel.createdTimestamp)),
- deleted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
- deletedBy: entry(audit.executor.id, renderUser(audit.executor))
- }
- if (channel.topic != null ?? false) list.topic = entry(channel.topic, `\`\`\`\n${channel.topic.replace('`', "'")}\n\`\`\``);
- else delete list.topic;
- if (channel.nsfw !== null ?? false) list.nsfw = entry(channel.nsfw, channel.nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`);
- else delete list.nsfw;
+ let emoji;
+ let readableType;
+ let displayName;
+ switch (channel.type) {
+ case 'GUILD_TEXT': {
+ emoji = "CHANNEL.TEXT.DELETE";
+ readableType = "Text";
+ displayName = "Text Channel"
+ break;
+ }
+ case 'GUILD_VOICE': {
+ emoji = "CHANNEL.VOICE.DELETE";
+ readableType = "Voice";
+ displayName = "Voice Channel"
+ break;
+ }
+ case 'GUILD_CATEGORY': {
+ emoji = "CHANNEL.CATEGORY.DELETE";
+ readableType = "Category";
+ displayName = "Category"
+ break;
+ }
+ default: {
+ emoji = "CHANNEL.TEXT.DELETE";
+ readableType = "Channel";
+ displayName = "Channel"
+ }
+ }
+ let list = {
+ id: entry(channel.id, `\`${channel.id}\``),
+ name: entry(channel.id, `${channel.name}`),
+ topic: null,
+ type: entry(channel.type, readableType),
+ category: entry(channel.parent ? channel.parent.id : null, channel.parent ? channel.parent.name : "Uncategorised"),
+ nsfw: null,
+ created: entry(channel.createdTimestamp, renderDelta(channel.createdTimestamp)),
+ deleted: entry(new Date().getTime(), renderDelta(new Date().getTime())),
+ deletedBy: entry(audit.executor.id, renderUser(audit.executor))
+ }
+ if (channel.topic != null ?? false) list.topic = entry(channel.topic, `\`\`\`\n${channel.topic.replace('`', "'")}\n\`\`\``);
+ else delete list.topic;
+ if (channel.nsfw !== null ?? false) list.nsfw = entry(channel.nsfw, channel.nsfw ? `${getEmojiByName("CONTROL.TICK")} Yes` : `${getEmojiByName("CONTROL.CROSS")} No`);
+ else delete list.nsfw;
- let data = {
- meta:{
- type: 'channelDelete',
- displayName: displayName + ' Deleted',
- calculateType: 'channelUpdate',
- color: NucleusColors.red,
- emoji: emoji,
- timestamp: audit.createdTimestamp
- },
- list: list,
- hidden: {
- guild: channel.guild.id
- }
- }
- log(data, channel.client);
+ let data = {
+ meta:{
+ type: 'channelDelete',
+ displayName: displayName + ' Deleted',
+ calculateType: 'channelUpdate',
+ color: NucleusColors.red,
+ emoji: emoji,
+ timestamp: audit.createdTimestamp
+ },
+ list: list,
+ hidden: {
+ guild: channel.guild.id
+ }
+ }
+ log(data, channel.client);
+ } catch {}
}