diff --git a/buttons/reakcnerole.js b/buttons/reakcnerole.js index 12be720..7379ff0 100644 --- a/buttons/reakcnerole.js +++ b/buttons/reakcnerole.js @@ -8,7 +8,7 @@ export default { handle: async (interaction, database) => { await interaction.defer(MessageFlags.EPHEMERAL) - const db = database.table(`rr`) + const db = await database.table(`rr`) const splitID = interaction.data.customID.split('.') diff --git a/commands/rr.js b/commands/rr.js index 07dc01d..1a8dec7 100644 --- a/commands/rr.js +++ b/commands/rr.js @@ -177,7 +177,7 @@ export default { }, handle: async (interaction, database) => { - const db = database.table(`rr`) + const db = await database.table(`rr`) const action = interaction.data.options.getSubCommand()[0] diff --git a/modals/reakcnerole.js b/modals/reakcnerole.js index 415bf28..7a60cdf 100644 --- a/modals/reakcnerole.js +++ b/modals/reakcnerole.js @@ -8,7 +8,7 @@ export default { handle: async (interaction, database) => { await interaction.defer(MessageFlags.EPHEMERAL) - const db = database.table(`rr`) + const db = await database.table(`rr`) const splitID = interaction.data.customID.split('.') diff --git a/utils/kvdb.js b/utils/kvdb.js index 77fb4b7..451aba1 100644 --- a/utils/kvdb.js +++ b/utils/kvdb.js @@ -32,10 +32,12 @@ export class KVDB { /** * Switch database table/context sharing the same connection pool * @param {string} newTableName - * @returns {KVDB} + * @returns {Promise} */ - table(newTableName) { - return new KVDB(this.pool, newTableName); + async table(newTableName) { + const newDb = new KVDB(this.pool, newTableName); + await newDb.init(); + return newDb; } /**