1
0
Fork 0

fix: argument parsing

master
Hiroyuki 2021-09-11 16:42:44 -04:00
parent 64a68e51a3
commit 12aab5aa56
No known key found for this signature in database
GPG Key ID: AF65958B7B7362E6
1 changed files with 4 additions and 4 deletions

View File

@ -26,7 +26,7 @@ export default class Usermod extends Command {
const modifyingPropertyResponse = await this.loading(message.channel, `Modifying \`${property}\` of \`${account.username}\`'s account...`); const modifyingPropertyResponse = await this.loading(message.channel, `Modifying \`${property}\` of \`${account.username}\`'s account...`);
await this.client.commands.get('notify') await this.client.commands.get('notify')
.run(message, [account.username, ...(`Your email address has been changed from ${account.emailAddress} to ${value}.`.split(' '))]); .run(message, [account.username, ...`Your email address has been changed from ${account.emailAddress} to ${value}.`.split(' ')]);
await account.updateOne({ emailAddress: value }); await account.updateOne({ emailAddress: value });
modifyingPropertyResponse.delete(); modifyingPropertyResponse.delete();
@ -44,7 +44,7 @@ export default class Usermod extends Command {
const modifyingPropertyResponse = await this.loading(message.channel, `Modifying \`${property}\` of \`${account.username}\`'s account...`); const modifyingPropertyResponse = await this.loading(message.channel, `Modifying \`${property}\` of \`${account.username}\`'s account...`);
try { try {
await this.client.commands.get('lock') await this.client.commands.get('lock')
.run(message, [account.username, ...(`Changing your username from \`${account.username}\` to \`${value}\`. DN/C`.split(' '))]); .run(message, [account.username, ...`Changing your username from \`${account.username}\` to \`${value}\`. DN/C`.split(' ')]);
await this.client.util.exec(`usermod -l ${value} ${account.username}`); await this.client.util.exec(`usermod -l ${value} ${account.username}`);
await this.client.util.exec(`usermod -d /home/${value} ${account.username}`); await this.client.util.exec(`usermod -d /home/${value} ${account.username}`);
@ -54,10 +54,10 @@ export default class Usermod extends Command {
homepath: `/home/${value}`, homepath: `/home/${value}`,
}); });
await this.client.commands.get('unlock') await this.client.commands.get('unlock')
.run(message, [value, ...(`Your username has been successfully changed. Remember to use \`ssh ${value}@cloud.libraryofcode.org\` when logging in.`)]); .run(message, [value, ...`Your username has been successfully changed. Remember to use \`ssh ${value}@cloud.libraryofcode.org\` when logging in.`.split(' ')]);
} catch (error) { } catch (error) {
await this.client.commands.get('unlock') await this.client.commands.get('unlock')
.run(message, [account.username, ...('Your username change was unsuccessful. Please contact a Technician for more details.')]); .run(message, [account.username, ...'Your username change was unsuccessful. Please contact a Technician for more details.'.split(' ')]);
this.error(message.channel, 'Failed to modify username.'); this.error(message.channel, 'Failed to modify username.');
return this.client.util.handleError(error); return this.client.util.handleError(error);
} }