Remove role on account delete

merge-requests/1/merge
Bsian 2019-11-01 10:51:45 +00:00
parent cd123f38a5
commit 01e0cafb6e
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
1 changed files with 4 additions and 0 deletions

View File

@ -173,8 +173,12 @@ export default class Util {
} }
public async deleteAccount(username: string): Promise<void> { public async deleteAccount(username: string): Promise<void> {
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.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 }); 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<Message> { public async messageCollector(message: Message, question: string, timeout: number, shouldDelete = false, choices: string[] = null, filter = (msg: Message): boolean|void => {}): Promise<Message> {