meta: fix null check misuses

This commit is contained in:
liushuyu 2020-07-26 21:42:40 -06:00
parent e22adc4777
commit 89ed704d09
No known key found for this signature in database
GPG Key ID: 23D1CE4534419437
3 changed files with 5 additions and 5 deletions

View File

@ -15,7 +15,7 @@ export function command (message: discord.Message) {
message.channel.send(`${user.toString()}, you have no warnings to clear.`); 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}].`); 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}].`); state.logChannel.send(`${message.author.toString()} has cleared all warnings for ${user.toString()} [${count?.length}].`);
}); });
}; };

View File

@ -21,14 +21,14 @@ export function command (message: discord.Message) {
} }
if (alreadyJoined) { 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.`); message.channel.send(`${user.toString()}'s speech has been revoked in the #development channel.`);
}).catch(() => { }).catch(() => {
state.logChannel.send(`Error revoking ${user.toString()}'s developer speech...`); state.logChannel.send(`Error revoking ${user.toString()}'s developer speech...`);
logger.error(`Error revoking ${user} ${user.username}'s developer speech...`); logger.error(`Error revoking ${user} ${user.username}'s developer speech...`);
}); });
} else { } else {
member?.roles.add(role).then(() => { member.roles.add(role).then(() => {
message.channel.send(`${user.toString()} has been granted speech in the #development channel.`); message.channel.send(`${user.toString()} has been granted speech in the #development channel.`);
}).catch(() => { }).catch(() => {
state.logChannel.send(`Error granting ${user.toString()}'s developer speech...`); state.logChannel.send(`Error granting ${user.toString()}'s developer speech...`);

View File

@ -90,7 +90,7 @@ client.on('messageDelete', message => {
.setColor('RED'); .setColor('RED');
state.msglogChannel.send(deletionEmbed); 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}.`);
} }
} }
}); });