forked from engineering/cloudservices
args check
parent
12cbb86f3f
commit
449eb8f501
|
@ -6,14 +6,14 @@ export default class Warn extends Command {
|
|||
super(client);
|
||||
this.name = 'warn';
|
||||
this.description = 'Sends an official warning to user.';
|
||||
this.usage = `${this.client.config.prefix}warn [username | user ID]`;
|
||||
this.usage = `${this.client.config.prefix}warn [username | user ID] [reason]`;
|
||||
this.permissions = { roles: ['662163685439045632', '701454780828221450'] };
|
||||
this.enabled = true;
|
||||
}
|
||||
|
||||
public async run(message: Message, args: string[]) {
|
||||
try {
|
||||
if (!args.length) return this.client.commands.get('help').run(message, [this.name]);
|
||||
if (!args.length || !args[1]) return this.client.commands.get('help').run(message, [this.name]);
|
||||
const edit = await this.loading(message.channel, 'Processing warning...');
|
||||
const account = await this.client.db.Account.findOne({ $or: [{ username: args[0] }, { userID: args[0].replace(/[<@!>]/gi, '') }] });
|
||||
if (!account) return edit.edit(`***${this.client.stores.emojis.error} Cannot find user.***`);
|
||||
|
|
Loading…
Reference in New Issue