Feature/vba 77 #178

Merged
Vylpes merged 13 commits from feature/VBA-77 into develop 2022-09-05 18:10:04 +01:00
Showing only changes of commit 10f23fedd9 - Show all commits

View file

@ -26,6 +26,9 @@ export default class Audits extends Command {
case "view": case "view":
await this.SendAudit(context); await this.SendAudit(context);
break; break;
case "clear":
await this.ClearAudit(context);
break;
default: default:
await this.SendUsage(context); await this.SendUsage(context);
} }
@ -37,6 +40,7 @@ export default class Audits extends Command {
const description = [ const description = [
`\`${prefix}audits user <id>\` - Send the audits for this user`, `\`${prefix}audits user <id>\` - Send the audits for this user`,
`\`${prefix}audits view <id>\` - Send information about an audit`, `\`${prefix}audits view <id>\` - Send information about an audit`,
`\`${prefix}audits clear <id>\` - Clears an audit for a user by audit id`,
VylpesTester commented 2022-08-20 20:59:48 +01:00 (Migrated from github.com)
Review

Move this into its own text file like the other files

Move this into its own text file like the other files
] ]
const publicEmbed = new PublicEmbed(context, "Usage", description.join("\n")); const publicEmbed = new PublicEmbed(context, "Usage", description.join("\n"));
@ -89,4 +93,27 @@ export default class Audits extends Command {
await publicEmbed.SendToCurrentChannel(); await publicEmbed.SendToCurrentChannel();
} }
private async ClearAudit(context: ICommandContext) {
const auditId = context.args[1];
if (!auditId) {
await this.SendUsage(context);
return;
}
const audit = await Audit.FetchAuditByAuditId(auditId.toUpperCase(), context.message.guild!.id);
if (!audit) {
const errorEmbed = new ErrorEmbed(context, "This audit can not be found.");
await errorEmbed.SendToCurrentChannel();
return;
}
await Audit.Remove(Audit, audit);
const publicEmbed = new PublicEmbed(context, "", "Audit cleared");
await publicEmbed.SendToCurrentChannel();
}
} }