From b7bf6569c92848ec0254ac94de924362126bc848 Mon Sep 17 00:00:00 2001 From: end-4 <97237370+end-4@users.noreply.github.com> Date: Sun, 31 Mar 2024 11:21:24 +0700 Subject: [PATCH] sidebar: booru: page support --- .config/ags/services/booru.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.config/ags/services/booru.js b/.config/ags/services/booru.js index a4f06d9a..304aba14 100644 --- a/.config/ags/services/booru.js +++ b/.config/ags/services/booru.js @@ -73,17 +73,21 @@ class BooruService extends Service { const userArgs = `${msg}${this._nsfw ? '' : ' rating:safe'}`.split(/\s+/); let taglist = []; + let page = 1; // Construct body/headers for (let i = 0; i < userArgs.length; i++) { const thisArg = userArgs[i].trim(); if (thisArg.length == 0 || thisArg == '.' || thisArg == '*') continue; + else if(!isNaN(thisArg)) page = parseInt(thisArg); else taglist.push(thisArg); } const newMessageId = this._queries.length; - this._queries.push(taglist.length == 0 ? ['*'] : taglist); + this._queries.push(taglist.length == 0 ? ['*', `${page}`] : [...taglist, `${page}`]); this.emit('newResponse', newMessageId); const params = { 'tags': taglist.join('+'), + 'page': `${page}`, + 'limit': `${userOptions.sidebar.imageBooruCount}`, }; const paramString = paramStringFromObj(params); // Fetch