mirror of
https://github.com/danbulant/dots-hyprland
synced 2026-05-24 20:31:57 +00:00
sidebar: booru: page support
This commit is contained in:
parent
fcce12ca48
commit
b7bf6569c9
1 changed files with 5 additions and 1 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Reference in a new issue