import db from "../sql.mjs"; import lib from "../lib.mjs"; import cfg from "../config.mjs"; export default async bot => { return [{ name: "f0ckrand", call: /^gib f0ck/i, active: false, f: async e => { let args = e.args.slice(1); /*let rows = sql("items").select("id", "username", "mime", "size"); for(let i = 0; i < args.length; i++) { if(args[i].charAt(0) === "!") rows = rows.where("username", "not ilike", args[i].slice(1)); else rows = rows.where("username", "ilike", args[i]); } rows = await rows.orderByRaw("random()").limit(1);*/ if(rows.length === 0) return e.reply("nothing found, f0cker"); return e.reply(`f0ckrnd: ${cfg.main.url.full}/${rows[0].id} by: ${rows[0].username} (${rows[0].mime}, ~${lib.formatSize(rows[0].size)})`); } }]; };