sideleft: booru qol

- '+' gives next page
- tags now get appended instead of sent
This commit is contained in:
end-4
2024-05-05 07:20:07 +07:00
parent 38c62ef651
commit 753fb448d0
2 changed files with 38 additions and 13 deletions
+4 -2
View File
@@ -80,14 +80,14 @@ class BooruService extends Service {
async fetch(msg) {
// Init
const userArgs = `${msg}${this._nsfw ? '' : ' rating:safe'}`.split(/\s+/);
const userArgs = `${msg}${this._nsfw || !msg.includes('safe') ? '' : ' 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;
if (thisArg.length == 0 || thisArg == '.' || thisArg.includes('*')) continue;
else if(!isNaN(thisArg)) page = parseInt(thisArg);
else taglist.push(thisArg);
}
@@ -95,6 +95,8 @@ class BooruService extends Service {
this._queries.push({
providerName: APISERVICES[this._mode].name,
taglist: taglist.length == 0 ? ['*', `${page}`] : [...taglist, `${page}`],
realTagList: taglist,
page: page,
});
this.emit('newResponse', newMessageId);
const params = {