From f547c321aee1795be674d5832a74ff131f605e48 Mon Sep 17 00:00:00 2001 From: Bsian Date: Sat, 21 Dec 2019 18:30:52 +0000 Subject: [PATCH] Delete group on account deletion --- src/class/Util.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/class/Util.ts b/src/class/Util.ts index 1f7481f..8e5aaed 100644 --- a/src/class/Util.ts +++ b/src/class/Util.ts @@ -154,9 +154,14 @@ export default class Util { const account = await this.client.db.Account.findOne({ username }); if (!account) throw new Error('Account not found'); this.exec(`lock ${username}`); - await this.exec(`deluser ${username} --remove-home --backup-to /management/Archives && rm -rf -R /home/${username}`); - await this.client.removeGuildMemberRole('446067825673633794', account.userID, '546457886440685578', 'Cloud Account Deleted'); - await this.client.db.Account.deleteOne({ username }); + const tasks = [ + this.exec(`deluser ${username} --remove-home --backup-to /management/Archives && rm -rf -R /home/${username}`), + this.client.removeGuildMemberRole('446067825673633794', account.userID, '546457886440685578', 'Cloud Account Deleted'), + this.client.db.Account.deleteOne({ username }), + this.exec(`groupdel ${username}`), + ]; + // @ts-ignore + await Promise.all(tasks); } public async messageCollector(message: Message, question: string, timeout: number, shouldDelete = false, choices: string[] = null, filter = (msg: Message): boolean|void => {}): Promise {