From 89ed704d09c6e2e59c643295f99bad7126ada80f Mon Sep 17 00:00:00 2001 From: liushuyu Date: Sun, 26 Jul 2020 21:42:40 -0600 Subject: [PATCH] meta: fix null check misuses --- src/commands/clearWarnings.ts | 4 ++-- src/commands/grantDeveloper.ts | 4 ++-- src/server.ts | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/commands/clearWarnings.ts b/src/commands/clearWarnings.ts index 76f4b04..8fb2fb0 100644 --- a/src/commands/clearWarnings.ts +++ b/src/commands/clearWarnings.ts @@ -15,7 +15,7 @@ export function command (message: discord.Message) { message.channel.send(`${user.toString()}, you have no warnings to clear.`); } - logger.info(`${message.author.username} has cleared all warnings for ${user} ${user.username} [${count.length}].`); - state.logChannel.send(`${message.author.toString()} has cleared all warnings for ${user.toString()} [${count.length}].`); + logger.info(`${message.author.username} has cleared all warnings for ${user} ${user.username} [${count?.length}].`); + state.logChannel.send(`${message.author.toString()} has cleared all warnings for ${user.toString()} [${count?.length}].`); }); }; diff --git a/src/commands/grantDeveloper.ts b/src/commands/grantDeveloper.ts index d5866a3..8019e9c 100644 --- a/src/commands/grantDeveloper.ts +++ b/src/commands/grantDeveloper.ts @@ -21,14 +21,14 @@ export function command (message: discord.Message) { } if (alreadyJoined) { - member?.roles.remove(role).then(() => { + member.roles.remove(role).then(() => { message.channel.send(`${user.toString()}'s speech has been revoked in the #development channel.`); }).catch(() => { state.logChannel.send(`Error revoking ${user.toString()}'s developer speech...`); logger.error(`Error revoking ${user} ${user.username}'s developer speech...`); }); } else { - member?.roles.add(role).then(() => { + member.roles.add(role).then(() => { message.channel.send(`${user.toString()} has been granted speech in the #development channel.`); }).catch(() => { state.logChannel.send(`Error granting ${user.toString()}'s developer speech...`); diff --git a/src/server.ts b/src/server.ts index e38b2da..55273f3 100644 --- a/src/server.ts +++ b/src/server.ts @@ -90,7 +90,7 @@ client.on('messageDelete', message => { .setColor('RED'); state.msglogChannel.send(deletionEmbed); - logger.info(`${message.author.username} ${message.author} deleted message: ${message.cleanContent}.`); + logger.info(`${message.author?.username} ${message.author} deleted message: ${message.cleanContent}.`); } } });