Fixed shit

merge-requests/1/merge
Bsian 2019-10-28 21:41:23 +00:00
parent 1a5e72f94f
commit 935d2147d3
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
1 changed files with 46 additions and 41 deletions

View File

@ -11,12 +11,13 @@ export default class CWG extends Command {
super(client);
this.name = 'cwg';
this.description = 'Manages aspects for the CWG.';
this.usage = `${this.client.config.prefix}cwg [User ID/Username] [Domain] [Port] <Path to x509 certificate> <Path to x509 key>`;
this.usage = `${this.client.config.prefix}cwg create [User ID/Username] [Domain] [Port] <Path to x509 certificate> <Path to x509 key>`;
this.permissions = { roles: ['525441307037007902'] };
this.enabled = true;
}
public async run(message: Message, args?: string[]) {
try {
if (!args.length) return this.client.commands.get('help').run(message, [this.name]);
/*
args[1] should be the user's ID OR account username; required
@ -26,6 +27,7 @@ export default class CWG extends Command {
args[5] should be the path to the x509 key; not required
*/
if (args[0] === 'create') {
if (!args[5]) return this.client.commands.get('help').run(message, [this.name]);
const account = await this.client.db.Account.findOne({ $or: [{ account: args[1] }, { userID: args[1] }] });
if (!account) return message.channel.createMessage(`${this.client.stores.emojis.error} Cannot locate account, please try again.`);
try {
@ -77,6 +79,9 @@ export default class CWG extends Command {
}
} else { message.channel.createMessage(`${this.client.stores.emojis.error} Not a valid subcommand.`); }
return true;
} catch (error) {
return this.client.util.handleError(error, message, this);
}
}
/**