From 01e0cafb6ef9937dd030832873ea83d0e78db930 Mon Sep 17 00:00:00 2001 From: Bsian Date: Fri, 1 Nov 2019 10:51:45 +0000 Subject: [PATCH] Remove role on account delete --- src/class/Util.ts | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/class/Util.ts b/src/class/Util.ts index 0f0bedb..bb87099 100644 --- a/src/class/Util.ts +++ b/src/class/Util.ts @@ -173,8 +173,12 @@ export default class Util { } public async deleteAccount(username: string): Promise { + const account = await this.client.db.Account.findOne({ username }); + if (!account) return Promise.reject(new Error('Account not found')); 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 }); + return Promise.resolve(); } public async messageCollector(message: Message, question: string, timeout: number, shouldDelete = false, choices: string[] = null, filter = (msg: Message): boolean|void => {}): Promise {