forked from engineering/cloudservices
commands that req arguments w/o produce help cmd
parent
62be202a2e
commit
8c887192e9
|
@ -16,6 +16,7 @@ export default class CWG extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
public async run(message: Message, args?: string[]) {
|
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[1] should be the user's ID OR account username; required
|
||||||
args[2] should be the domain; required
|
args[2] should be the domain; required
|
||||||
|
|
|
@ -16,6 +16,7 @@ export default class Lock extends Command {
|
||||||
|
|
||||||
public async run(message: Message, args: string[]) { // eslint-disable-line
|
public async run(message: Message, args: string[]) { // eslint-disable-line
|
||||||
try {
|
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, '') }] });
|
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) 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.***`);
|
if (account.locked) return message.channel.createMessage(`***${this.client.stores.emojis.error} This account is already locked.***`);
|
||||||
|
|
|
@ -16,6 +16,7 @@ export default class Modlogs extends Command {
|
||||||
|
|
||||||
public async run(message: Message, args: string[]) {
|
public async run(message: Message, args: string[]) {
|
||||||
try {
|
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 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, '') }] });
|
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(' ')}***`);
|
if (!query.length) return msg.edit(`***${this.client.stores.emojis.error} Cannot locate modlogs for ${args.join(' ')}***`);
|
||||||
|
|
|
@ -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('Load Average (last 15 minutes)', os.loadavg()[2].toFixed(3), true);
|
||||||
embed.addField('Memory/RAM', `${usedMemory} / ${dataConversion(totalmem())}`, 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 (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.setFooter(this.client.user.username, this.client.user.avatarURL);
|
||||||
embed.setTimestamp();
|
embed.setTimestamp();
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
|
|
|
@ -14,6 +14,7 @@ export default class Unlock extends Command {
|
||||||
|
|
||||||
public async run(message: Message, args: string[]) { // eslint-disable-line
|
public async run(message: Message, args: string[]) { // eslint-disable-line
|
||||||
try {
|
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, '') }] });
|
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) 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.***`);
|
if (!account.locked) return message.channel.createMessage(`***${this.client.stores.emojis.error} This account is already unlocked.***`);
|
||||||
|
|
Loading…
Reference in New Issue