cloudservices/src/class/Command.ts

54 lines
1.3 KiB
TypeScript

import { Message, TextableChannel } from 'eris';
import { Client, Collection } from '.';
export default class Command {
name: string
parentName: string
description?: string
usage?: string
enabled: boolean
aliases?: string[]
client: Client
permissions?: { roles?: string[], users?: string[] }
guildOnly?: boolean
subcmds?: any[]
subcommands?: Collection<Command>
public run(message: Message, args: string[]): Promise<any> { return Promise.resolve(); }
constructor(client: Client) {
this.name = 'None';
this.description = 'No description given';
this.usage = 'No usage given';
this.enabled = true;
this.aliases = [];
this.guildOnly = true;
this.client = client;
this.subcmds = [];
this.subcommands = new Collection<Command>();
this.permissions = {};
}
public success(channel: TextableChannel, txt: string) {
return channel.createMessage(`***${this.client.stores.emojis.success} ${txt}***`);
}
public loading(channel: TextableChannel, txt: string) {
return channel.createMessage(`***${this.client.stores.emojis.loading} ${txt}***`);
}
public error(channel: TextableChannel, txt: string) {
return channel.createMessage(`***${this.client.stores.emojis.error} ${txt}***`);
}
}