VBC-52 Use export default rather than class of the same name #53

Merged
Vylpes merged 4 commits from feature/VBC-52 into develop 2021-09-29 17:53:21 +01:00
2 changed files with 6 additions and 6 deletions
Showing only changes of commit 00a057792b - Show all commits

View file

@ -20,7 +20,7 @@ export class Events {
// Emit when a message is sent
// Used to check for commands
public onMessage(message: Message): IEventResponse {
public async onMessage(message: Message): Promise<IEventResponse> {
if (!message.guild) return {
valid: false,
message: "Message was not sent in a guild, ignoring.",
@ -42,7 +42,7 @@ export class Events {
message: "Command name was not found",
};
const res = this._util.loadCommand(name, args, message);
const res = await this._util.loadCommand(name, args, message);
if (!res.valid) {
return {

View file

@ -16,7 +16,7 @@ export interface IUtilResponse extends IBaseResponse {
// Util Class
export class Util {
public loadCommand(name: string, args: string[], message: Message): IUtilResponse {
public async loadCommand(name: string, args: string[], message: Message): Promise<IUtilResponse> {
if (!message.member) return {
valid: false,
message: "Member is not part of message",
@ -37,9 +37,9 @@ export class Util {
if (existsSync(`${process.cwd()}/${folder}/`)) {
if (existsSync(`${process.cwd()}/${folder}/${name}.ts`)) {
const commandFile = require(`${process.cwd()}/${folder}/${name}.ts`);
const command = new commandFile[name]() as Command;
const commandFile = require(`${process.cwd()}/${folder}/${name}.ts`).default;
const command = new commandFile() as Command;
const requiredRoles = command._roles;
if (!command._category) command._category = "none";