Skip to content

Commit

Permalink
Fix embed, use variable to clean up conditionals (#193)
Browse files Browse the repository at this point in the history
- changed the embed to use the `username` value instead of a direct mention. Also threw in a variable for `message.member.mentions?.first()`.

Closes #192
  • Loading branch information
Nicholas Carrigan (he/him) committed Oct 5, 2020
1 parent 8b6bb03 commit bde6c1b
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/commands/close.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ export const closeCommand: CommandDef = {
);
return;
}

const member = message.mentions.members?.first();
let status = 'The appeal was not approved.';
if (flag === 'accepted') {
if (!message.mentions.members?.first()) {
if (!member) {
message.channel.send(
'Please provide the user mention for the user to unsuspend.'
);
Expand All @@ -68,8 +68,8 @@ export const closeCommand: CommandDef = {
logger.warn('Cannot find suspend role');
message.channel.send('Sorry, I could not find your suspended role.');
} else {
await message.mentions.members.first()?.roles.remove([suspend]);
status = `The appeal was approved and ${message.mentions.members.first()}'s access was restored.`;
await member.roles.remove([suspend]);
status = `The appeal was approved and \`${member.user.username}\`'s access was restored.`;
}
}
await target.delete();
Expand Down

0 comments on commit bde6c1b

Please sign in to comment.