forked from engineering/cloudservices
Util class is binded to client, no need to make another class for each command
parent
83452d5184
commit
ba27e52e0c
|
@ -2,11 +2,8 @@ import fs from 'fs-extra';
|
||||||
import { Message } from 'eris';
|
import { Message } from 'eris';
|
||||||
import Client from '../Client';
|
import Client from '../Client';
|
||||||
import Command from '../class/Command';
|
import Command from '../class/Command';
|
||||||
import Util from '../Util';
|
|
||||||
|
|
||||||
export default class Lock extends Command {
|
export default class Lock extends Command {
|
||||||
util: Util = new Util(this.client)
|
|
||||||
|
|
||||||
constructor(client: Client) {
|
constructor(client: Client) {
|
||||||
super(client);
|
super(client);
|
||||||
this.name = 'lock';
|
this.name = 'lock';
|
||||||
|
@ -21,7 +18,7 @@ export default class Lock extends Command {
|
||||||
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.***`);
|
||||||
const edit = await message.channel.createMessage(`***${this.client.stores.emojis.loading} Locking account...***`);
|
const edit = await message.channel.createMessage(`***${this.client.stores.emojis.loading} Locking account...***`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
return this.util.handleError(error, message, this);
|
return this.client.util.handleError(error, message, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
import { Message } from 'eris';
|
import { Message } from 'eris';
|
||||||
|
// eslint-disable-next-line import/no-unresolved
|
||||||
import { createPaginationEmbed } from 'eris-pagination';
|
import { createPaginationEmbed } from 'eris-pagination';
|
||||||
import Client from '../Client';
|
import Client from '../Client';
|
||||||
import Command from '../class/Command';
|
import Command from '../class/Command';
|
||||||
|
|
|
@ -1,11 +1,8 @@
|
||||||
import { Message } from 'eris';
|
import { Message } from 'eris';
|
||||||
import Client from '../Client';
|
import Client from '../Client';
|
||||||
import Command from '../class/Command';
|
import Command from '../class/Command';
|
||||||
import Util from '../Util';
|
|
||||||
|
|
||||||
export default class Ping extends Command {
|
export default class Ping extends Command {
|
||||||
util: Util = new Util(this.client)
|
|
||||||
|
|
||||||
constructor(client: Client) {
|
constructor(client: Client) {
|
||||||
super(client);
|
super(client);
|
||||||
this.name = 'ping';
|
this.name = 'ping';
|
||||||
|
@ -19,7 +16,7 @@ export default class Ping extends Command {
|
||||||
const msg: Message = await message.channel.createMessage('🏓 Pong!');
|
const msg: Message = await message.channel.createMessage('🏓 Pong!');
|
||||||
msg.edit(`🏓 Pong!\nClient: \`${Date.now() - clientStart}ms\`\nResponse: \`${msg.createdAt - message.createdAt}ms\``);
|
msg.edit(`🏓 Pong!\nClient: \`${Date.now() - clientStart}ms\`\nResponse: \`${msg.createdAt - message.createdAt}ms\``);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
this.util.handleError(error, message, this);
|
this.client.util.handleError(error, message, this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue