diff --git a/src/structure/storage/interfaces/Provider.js b/src/structure/storage/interfaces/Provider.js index b3b1333..d52fd9f 100644 --- a/src/structure/storage/interfaces/Provider.js +++ b/src/structure/storage/interfaces/Provider.js @@ -79,6 +79,13 @@ class Provider { } this.tables[table.name] = table; + // Defines quick access getter for the table + Object.defineProperty(this, table.name, { + enumerable: true, + get: () => { + return this.tables[table.name]; + } + }); this.storageManager._log(`Table ${chalk.bold(table.name)} was ${chalk.bold('loaded')}.`, table); return table; diff --git a/src/structure/storage/providers/Mongodb.js b/src/structure/storage/providers/Mongodb.js index c51a6af..cbda31e 100644 --- a/src/structure/storage/providers/Mongodb.js +++ b/src/structure/storage/providers/Mongodb.js @@ -48,42 +48,43 @@ class MongoDBProvider extends Provider { } - get guilds() { - return this.tables.guilds; - } + // Defined by Object.defineProperty in the provider superclass + // get guilds() { + // return this.tables.guilds; + // } - get permissions() { - return this.tables.permissions; - } + // get permissions() { + // return this.tables.permissions; + // } - get infractions() { - return this.tables.infractions; - } + // get infractions() { + // return this.tables.infractions; + // } - get messages() { - return this.tables.messages; - } + // get messages() { + // return this.tables.messages; + // } - get attachments() { - return this.tables.attachments; - } + // get attachments() { + // return this.tables.attachments; + // } - get users() { - return this.tables.users; - } + // get users() { + // return this.tables.users; + // } - // eslint-disable-next-line camelcase - get role_cache() { - return this.tables.role_cache; - } + // // eslint-disable-next-line camelcase + // get role_cache() { + // return this.tables.role_cache; + // } - get webhooks() { - return this.tables.webhooks; - } + // get webhooks() { + // return this.tables.webhooks; + // } - get wordwatcher() { - return this.tables.wordwatcher; - } + // get wordwatcher() { + // return this.tables.wordwatcher; + // } }