community-relations/src/commands/x509_remove.ts

23 lines
909 B
TypeScript

import { Message } from 'eris';
import { Command, Client } from '../class';
export default class X509_Remove extends Command {
constructor(client: Client) {
super(client);
this.name = 'remove';
this.aliases = ['rm', 'delete', 'del', 'unlink', 'disconnect'];
this.description = 'Removes a currently connected X.509 certificate from your account.';
this.usage = `${this.client.config.prefix}x509 ${this.name}`;
this.permissions = 0;
this.guildOnly = true;
this.enabled = true;
}
public async run(message: Message) {
const profile = await this.client.db.Member.findOne({ userID: message.author.id });
if (!profile?.x509) return this.error(message.channel, 'There are no X.509 certificates connected to your account.');
await profile.updateOne({ $unset: { x509: '' } });
this.success(message.channel, 'Unlinked X.509 certificate from your account.');
}
}