thumbnailer trigger
All checks were successful
fetch npm modules / f0ck the f0cker (push) Successful in 36s
All checks were successful
fetch npm modules / f0ck the f0cker (push) Successful in 36s
This commit is contained in:
parent
8e02892df0
commit
223c8893df
|
@ -60,7 +60,7 @@ export default async bot => {
|
||||||
const tmpc = await lib.countf0cks();
|
const tmpc = await lib.countf0cks();
|
||||||
await e.reply(`tagged: ${tmpc.tagged}; untagged: ${tmpc.untagged}; sfw: ${tmpc.sfw}; nsfw: ${tmpc.nsfw}; total: ${tmpc.total}`);
|
await e.reply(`tagged: ${tmpc.tagged}; untagged: ${tmpc.untagged}; sfw: ${tmpc.sfw}; nsfw: ${tmpc.nsfw}; total: ${tmpc.total}`);
|
||||||
break;
|
break;
|
||||||
case "autotagger":
|
/*case "autotagger":
|
||||||
const body = { headers: { Authorization: `Basic ${cfg.tagger.btoa}` } };
|
const body = { headers: { Authorization: `Basic ${cfg.tagger.btoa}` } };
|
||||||
const res = await (await fetch(`${cfg.tagger.endpoint}/usage`, body)).json();
|
const res = await (await fetch(`${cfg.tagger.endpoint}/usage`, body)).json();
|
||||||
if(res) {
|
if(res) {
|
||||||
|
@ -69,7 +69,7 @@ export default async bot => {
|
||||||
return await e.reply(`autotagger: usage/limit: ${processed}/${limit}`);
|
return await e.reply(`autotagger: usage/limit: ${processed}/${limit}`);
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
break;
|
break;*/
|
||||||
/*case "renameTag":
|
/*case "renameTag":
|
||||||
const origTag = e.args.slice(1).join(' ');
|
const origTag = e.args.slice(1).join(' ');
|
||||||
|
|
||||||
|
|
42
src/inc/trigger/thumbnails.mjs
Normal file
42
src/inc/trigger/thumbnails.mjs
Normal file
|
@ -0,0 +1,42 @@
|
||||||
|
import queue from '../queue.mjs';
|
||||||
|
import db from '../sql.mjs';
|
||||||
|
|
||||||
|
export default async bot => {
|
||||||
|
|
||||||
|
return [{
|
||||||
|
name: "thumbnailer",
|
||||||
|
call: /^\!thumb \d+/i,
|
||||||
|
active: true,
|
||||||
|
level: 100,
|
||||||
|
f: async e => {
|
||||||
|
let processed = [];
|
||||||
|
|
||||||
|
for(let id of e.args) {
|
||||||
|
id = +id;
|
||||||
|
if(id <= 1)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
const f0ck = await db`
|
||||||
|
select dest, mime, username, userchannel, usernetwork
|
||||||
|
from "items"
|
||||||
|
where
|
||||||
|
id = ${id} and
|
||||||
|
active = 'true'
|
||||||
|
limit 1
|
||||||
|
`;
|
||||||
|
|
||||||
|
if(f0ck.length === 0) {
|
||||||
|
await e.reply(`f0ck ${id}: f0ck not found`);
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// gen thumb
|
||||||
|
await queue.genThumbnail(f0ck[0].dest, f0ck[0].mime, f0ck[0].id, f0ck[0].src);
|
||||||
|
|
||||||
|
processed.push(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
return await e.reply(`thumbnails: ${processed.length}/${e.args.length} (${processed.join(",")})`);
|
||||||
|
}
|
||||||
|
}];
|
||||||
|
};
|
Loading…
Reference in New Issue
Block a user