2020-04-03 13:12:35 +02:00
|
|
|
import cfg from "../../../config.json";
|
|
|
|
import sql from "../sql.mjs";
|
|
|
|
import lib from "../lib.mjs";
|
|
|
|
|
2021-05-15 13:58:24 +02:00
|
|
|
const regex = /(https\:\/\/f0ck\.me|http\:\/\/fockmoonsb24iczs7odozzy5uktlzbcgp337nabrgffzxv5ihabgpvyd\.onion)(\/(video|image|audio))?\/(\d+|(?:b\/)(\w{8})\.(jpg|webm|gif|mp4|png|mov|mp3|ogg|flac))/gi;
|
2020-04-03 13:12:35 +02:00
|
|
|
|
|
|
|
export default async bot => {
|
|
|
|
|
|
|
|
return [{
|
|
|
|
name: "f0ckgag",
|
|
|
|
call: regex,
|
|
|
|
active: true,
|
|
|
|
f: async e => {
|
|
|
|
const dat = e.message.match(regex)[0].split(/\//).pop();
|
2021-05-16 13:24:31 +02:00
|
|
|
let query = sql("items").select("id", "mime", "size", "username", "userchannel", "usernetwork", "stamp");
|
2020-04-03 13:12:35 +02:00
|
|
|
|
2021-05-16 13:24:31 +02:00
|
|
|
if(dat.includes("."))
|
|
|
|
query = query.where("dest", "like", `%${dat}%`);
|
|
|
|
else
|
|
|
|
query = query.where("id", dat);
|
2020-04-03 13:12:35 +02:00
|
|
|
|
2021-05-16 13:24:31 +02:00
|
|
|
const rows = await query;
|
2020-04-03 13:12:35 +02:00
|
|
|
if(rows.length === 0)
|
|
|
|
return e.reply("no f0cks given! lol D:");
|
|
|
|
|
|
|
|
e.reply([
|
|
|
|
`${cfg.main.url}/${rows[0].id}`,
|
|
|
|
`user: ${rows[0].username} @ ${rows[0].usernetwork} ${rows[0].userchannel}`,
|
|
|
|
`~${lib.formatSize(rows[0].size)}`,
|
|
|
|
rows[0].mime,
|
|
|
|
new Date(rows[0].stamp * 1e3).toString().slice(0, 24)
|
|
|
|
].join(" - "));
|
|
|
|
}
|
|
|
|
}];
|
|
|
|
};
|