From 1626f7bb5173aa6d2cfd9614e4df1b7941d0f19b Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Wed, 15 May 2024 19:13:19 +0700 Subject: [PATCH] booru: fix messed up responses --- .config/ags/services/booru.js | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.config/ags/services/booru.js b/.config/ags/services/booru.js index d00643e62..954170404 100644 --- a/.config/ags/services/booru.js +++ b/.config/ags/services/booru.js @@ -72,7 +72,7 @@ class BooruService extends Service { this._mode = value; this._baseUrl = APISERVICES[this._mode].endpoint; } - get providerName () { + get providerName() { return APISERVICES[this._mode].name; } get queries() { return this._queries } @@ -88,7 +88,7 @@ class BooruService extends Service { for (let i = 0; i < userArgs.length; i++) { const thisArg = userArgs[i].trim(); if (thisArg.length == 0 || thisArg == '.' || thisArg.includes('*')) continue; - else if(!isNaN(thisArg)) page = parseInt(thisArg); + else if (!isNaN(thisArg)) page = parseInt(thisArg); else taglist.push(thisArg); } const newMessageId = this._queries.length; @@ -113,6 +113,7 @@ class BooruService extends Service { }; let status = 0; // console.log(`${APISERVICES[this._mode].endpoint}?${paramString}`); + Utils.fetch(`${APISERVICES[this._mode].endpoint}?${paramString}`, options) .then(result => { status = result.status; @@ -122,7 +123,7 @@ class BooruService extends Service { // console.log(dataString); const parsedData = JSON.parse(dataString); // console.log(parsedData) - this._responses.push(parsedData.map(obj => { + this._responses[newMessageId] = parsedData.map(obj => { return { aspect_ratio: obj.width / obj.height, id: obj.id, @@ -140,7 +141,7 @@ class BooruService extends Service { file_height: obj.file_height, source: getWorkingImageSauce(obj.source), } - })); + }); this.emit('updateResponse', newMessageId); }) .catch(print);