const { Client } = require("@androz2091/insta.js"), Collection = require("@discordjs/collection") path = require("path"); class InstaBot extends Client { constructor(options) { super(options); ["commands", "aliases", "cooldowns"].forEach(x => this[x] = new Collection()); this.config = require("../config"); this.logger = require("../Helpers/logger"); } loadCommand(commandPath, commandName) { try { const props = new (require(`.${commandPath}${path.sep}${commandName}`))(this); props.conf.location = commandPath; if (props.init){ props.init(this); } this.commands.set(props.help.name, props); props.conf.aliases.forEach((alias) => { this.aliases.set(alias, props.help.name); }); return false; } catch (e) { return `Unable to load command ${commandName}: ${e}`; } } async unloadCommand (commandPath, commandName) { let command; if(this.commands.has(commandName)) { command = this.commands.get(commandName); } else if(this.aliases.has(commandName)){ command = this.commands.get(this.aliases.get(commandName)); } if(!command){ return `The command \`${commandName}\` doesn't seem to exist, nor is it an alias. Try again!`; } if(command.shutdown){ await command.shutdown(this); } delete require.cache[require.resolve(`.${commandPath}${path.sep}${commandName}.js`)]; return false; } } module.exports = InstaBot;