commands that req arguments w/o produce help cmd

merge-requests/1/merge
Matthew 2019-10-27 23:04:49 -04:00
parent 62be202a2e
commit 8c887192e9
No known key found for this signature in database
GPG Key ID: 766BE43AE75F7559
5 changed files with 5 additions and 1 deletions

View File

@ -16,6 +16,7 @@ export default class CWG extends Command {
}
public async run(message: Message, args?: string[]) {
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
args[2] should be the domain; required

View File

@ -16,6 +16,7 @@ export default class Lock extends Command {
public async run(message: Message, args: string[]) { // eslint-disable-line
try {
if (!args.length) return this.client.commands.get('help').run(message, [this.name]);
const account = await this.client.db.Account.findOne({ $or: [{ account: args[0] }, { userID: args[0].replace(/[<@!>]/gi, '') }] });
if (!account) return message.channel.createMessage(`***${this.client.stores.emojis.error} Cannot find user.***`);
if (account.locked) return message.channel.createMessage(`***${this.client.stores.emojis.error} This account is already locked.***`);

View File

@ -16,6 +16,7 @@ export default class Modlogs extends Command {
public async run(message: Message, args: string[]) {
try {
if (!args.length) return this.client.commands.get('help').run(message, [this.name]);
const msg: Message = await message.channel.createMessage(`***${this.client.stores.emojis.loading} Locating modlogs...***`);
const query = await this.client.db.Moderation.find({ $or: [{ username: args.join(' ') }, { userID: args.filter((a) => a)[0].replace(/[<@!>]/g, '') }] });
if (!query.length) return msg.edit(`***${this.client.stores.emojis.error} Cannot locate modlogs for ${args.join(' ')}***`);

View File

@ -27,7 +27,7 @@ export default class SysInfo extends Command {
embed.addField('Load Average (last 15 minutes)', os.loadavg()[2].toFixed(3), true);
embed.addField('Memory/RAM', `${usedMemory} / ${dataConversion(totalmem())}`, true);
embed.addField('Network Interfaces (IPv4)', os.networkInterfaces().eth0.filter((r) => r.family === 'IPv4')[0].address, true);
embed.addField('Network Interfaces (IPv6)', os.networkInterfaces().eth0.filter((r) => r.family === 'IPv6')[0].address, true);
embed.addField('Network Interfaces (IPv6)', os.networkInterfaces().eth0.filter((r) => r.family === 'IPv6')[0].address.replace(/:/gi, '\:'), true); // eslint-disable-line
embed.setFooter(this.client.user.username, this.client.user.avatarURL);
embed.setTimestamp();
// @ts-ignore

View File

@ -14,6 +14,7 @@ export default class Unlock extends Command {
public async run(message: Message, args: string[]) { // eslint-disable-line
try {
if (!args.length) return this.client.commands.get('help').run(message, [this.name]);
const account = await this.client.db.Account.findOne({ $or: [{ account: args[0] }, { userID: args[0].replace(/[<@!>]/gi, '') }] });
if (!account) return message.channel.createMessage(`***${this.client.stores.emojis.error} Cannot find user.***`);
if (!account.locked) return message.channel.createMessage(`***${this.client.stores.emojis.error} This account is already unlocked.***`);