merge-requests/4/head
Bsian 2020-06-09 12:40:02 +01:00
parent a979f73890
commit d534ea163d
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
1 changed files with 2 additions and 4 deletions

View File

@ -25,10 +25,8 @@ export default class Lock extends Command {
await account.updateOne({ locked: true }); await account.updateOne({ locked: true });
const expiry = new Date(); const expiry = new Date();
const lockLength = args[1].match(/[a-z]+|[^a-z]+/gi); const [length, unit] = args[1].match(/[a-z]+|[^a-z]+/gi);
const length = Number(lockLength[0]); const momentMilliseconds = moment.duration(Number(length), unit as unitOfTime.Base).asMilliseconds();
const unit = lockLength[1] as unitOfTime.Base;
const momentMilliseconds = moment.duration(length, unit).asMilliseconds();
const reason = momentMilliseconds ? args.slice(2).join(' ') : args.slice(1).join(' '); const reason = momentMilliseconds ? args.slice(2).join(' ') : args.slice(1).join(' ');
await this.client.util.createModerationLog(account.userID, message.member, 2, reason, momentMilliseconds); await this.client.util.createModerationLog(account.userID, message.member, 2, reason, momentMilliseconds);