From 3a59f772ae0668d4b1f1e5706fb2d254679d0a9d Mon Sep 17 00:00:00 2001 From: almeidx Date: Thu, 29 Jul 2021 01:18:06 +0100 Subject: [PATCH] use optional chaining and createdTimestamp on embed --- backend/src/plugins/Spam/util/logAndDetectMessageSpam.ts | 4 ++-- .../plugins/Starboard/util/createStarboardEmbedFromMessage.ts | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/backend/src/plugins/Spam/util/logAndDetectMessageSpam.ts b/backend/src/plugins/Spam/util/logAndDetectMessageSpam.ts index b5f9bbba..e34b34c2 100644 --- a/backend/src/plugins/Spam/util/logAndDetectMessageSpam.ts +++ b/backend/src/plugins/Spam/util/logAndDetectMessageSpam.ts @@ -120,8 +120,8 @@ export async function logAndDetectMessageSpam( // Then, if enabled, remove the spam messages if (spamConfig.clean !== false) { msgIds.forEach(id => pluginData.state.logs.ignoreLog(LogType.MESSAGE_DELETE, id)); - (pluginData.guild.channels.cache.get(savedMessage.channel_id as Snowflake)! as TextChannel) - .bulkDelete(msgIds as Snowflake[]) + (pluginData.guild.channels.cache.get(savedMessage.channel_id as Snowflake)! as TextChannel | undefined) + ?.bulkDelete(msgIds as Snowflake[]) .catch(noop); } diff --git a/backend/src/plugins/Starboard/util/createStarboardEmbedFromMessage.ts b/backend/src/plugins/Starboard/util/createStarboardEmbedFromMessage.ts index 0cc579a9..e1fe0aed 100644 --- a/backend/src/plugins/Starboard/util/createStarboardEmbedFromMessage.ts +++ b/backend/src/plugins/Starboard/util/createStarboardEmbedFromMessage.ts @@ -21,7 +21,7 @@ export function createStarboardEmbedFromMessage( name: `${msg.author.tag}`, }, fields: [], - timestamp: msg.createdAt, + timestamp: msg.createdTimestamp, }; if (color != null) {