1
0
Fork 0

Fixed errors throwing starting prefix

refactor/models
Bsian 2019-12-01 01:29:24 +00:00
parent 98c3b22f66
commit 85a60c00e7
No known key found for this signature in database
GPG Key ID: 097FB9A291026091
2 changed files with 4 additions and 4 deletions

View File

@ -20,13 +20,13 @@ export default class Load extends Command {
if (!allowed.includes(type)) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Invalid type to (re)load***`); if (!allowed.includes(type)) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Invalid type to (re)load***`);
const corepath = '/var/CloudServices/dist'; const corepath = '/var/CloudServices/dist';
if (type === 'config') this.client.config = require(`${corepath}/config.json`).default; if (type === 'config') this.client.config = require(`${corepath}/config.json`);
else if (type === 'util') { else if (type === 'util') {
const Util = require(`${corepath}/class/Util`); const Util = require(`${corepath}/class/Util`).default;
this.client.util = new Util(this.client); this.client.util = new Util(this.client);
} else { } else {
try { try {
const cmdIndex = require(`${corepath}/commands`); const cmdIndex = require('../commands');
let Cmd = cmdIndex[args[1]]; let Cmd = cmdIndex[args[1]];
if (!Cmd) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Could not find file***`); if (!Cmd) return message.channel.createMessage(`${this.client.stores.emojis.error} ***Could not find file***`);
Cmd = require(`${corepath}/commands/${args[1]}`).default; Cmd = require(`${corepath}/commands/${args[1]}`).default;

View File

@ -15,7 +15,7 @@ export default class {
if (message.content.indexOf(this.client.config.prefix) !== 0) return; if (message.content.indexOf(this.client.config.prefix) !== 0) return;
const noPrefix: string[] = message.content.slice(this.client.config.prefix.length).trim().split(/ +/g); const noPrefix: string[] = message.content.slice(this.client.config.prefix.length).trim().split(/ +/g);
const resolved = await this.client.util.resolveCommand(noPrefix, message); const resolved = await this.client.util.resolveCommand(noPrefix, message);
if (!resolved.cmd) return; if (!resolved) return;
if (resolved.cmd.guildOnly && !(message.channel instanceof TextChannel)) return; if (resolved.cmd.guildOnly && !(message.channel instanceof TextChannel)) return;
let hasUserPerms: boolean; let hasUserPerms: boolean;
if (resolved.cmd.permissions.users) { if (resolved.cmd.permissions.users) {