Skip to content

Commit

Permalink
response to feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
horrible-little-slime committed Dec 1, 2023
1 parent f3241e5 commit 54cd901
Showing 1 changed file with 15 additions and 7 deletions.
22 changes: 15 additions & 7 deletions src/commands/misc/rename.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,14 +39,17 @@ export async function execute(interaction: ChatInputCommandInteraction) {
}

const name = interaction.options.getString("name", true);
await discordClient.user?.setUsername(name);
const oaf = discordClient.user;

if (discordClient.user?.username === name) {
return void (await interaction.reply({
content: `Done! My name is now ${name}`,
ephemeral: true,
}));
} else {
if (!oaf) {
return void (await discordClient.alert(
"Unfortunately, O.A.F. does not exist.",
));
}

await oaf.setUsername(name);

if (oaf.username !== name) {
discordClient.alert(
`${interaction.user.username} tried to change O.A.F.'s name to ${name}, but failed!`,
);
Expand All @@ -55,4 +58,9 @@ export async function execute(interaction: ChatInputCommandInteraction) {
ephemeral: true,
}));
}

return void (await interaction.reply({
content: `Done! My name is now ${name}`,
ephemeral: true,
}));
}

0 comments on commit 54cd901

Please sign in to comment.