From 6ab1adfe5b86201cebea8dd146431d4d8b0da9ec Mon Sep 17 00:00:00 2001 From: Jiiks Date: Mon, 20 Aug 2018 02:39:48 +0300 Subject: [PATCH] Use findOne --- client/src/builtin/EmoteModule.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/client/src/builtin/EmoteModule.js b/client/src/builtin/EmoteModule.js index 9c6520ea..b6dccf7f 100644 --- a/client/src/builtin/EmoteModule.js +++ b/client/src/builtin/EmoteModule.js @@ -46,10 +46,10 @@ export default new class EmoteModule extends BuiltinModule { await this.loadLocalDb(); } - const userData = await Database.find({ 'id': 'EmoteModule' }); - if (userData && userData.length) { - if (userData[0].hasOwnProperty('favourites')) this._favourites = userData[0].favourites; - if (userData[0].hasOwnProperty('mostused')) this._mostUsed = userData[0].mostused; + const userData = await Database.findOne({ 'id': 'EmoteModule' }); + if (userData) { + if (userData.hasOwnProperty('favourites')) this._favourites = userData.favourites; + if (userData.hasOwnProperty('mostused')) this._mostUsed = userData.mostused; } this.patchMessageContent();