// code from goatstore // api: https://store.agi.bd const axios = require("axios"); exports.config = { name: "waifu", version: "1.1", author: "—͞𝐏ʀɪᴍᴇ́", countDown: 5, role: 0, shortDescription: "Random waifu image", longDescription: "Get random waifu images with fallback APIs", category: "image", guide: { en: "{pn} neko / waifu / hug / kiss etc" } }; exports.onStart = async function({ api, event, args, message }) { const valid = ["waifu","neko","shinobu","megumin","bully","cuddle","cry","hug","awoo","kiss","lick","pat","smug","bonk","yeet","blush","smile","wave","highfive","handhold","nom","bite","glomp","slap","kill","kick","happy","wink","poke","dance","cringe"]; let type = (args[0] || "waifu").toLowerCase(); if (!valid.includes(type)) type = "waifu"; let imageUrl = null; // Try 1: waifu.pics try { const res = await axios.get(`https://api.waifu.pics/sfw/${type}`, { timeout: 10000 }); if (res.data && res.data.url) imageUrl = res.data.url; } catch (e) {} // Try 2: waifu.im (fallback) if (!imageUrl) { try { const res = await axios.get(`https://api.waifu.im/search?is_nsfw=false`, { timeout: 10000 }); if (res.data && res.data.images && res.data.images[0]) { imageUrl = res.data.images[0].url; } } catch (e) {} } // Try 3: nekos.best (final fallback) if (!imageUrl) { try { const res = await axios.get(`https://nekos.best/api/v2/neko`, { timeout: 10000 }); if (res.data && res.data.results && res.data.results[0]) { imageUrl = res.data.results[0].url; } } catch (e) {} } if (!imageUrl) { return message.reply("❌ All APIs are down right now. Try again after 1 min."); } try { const stream = await global.utils.getStreamFromURL(imageUrl); return message.reply({ body: `Here's your ${type} 🥰`, attachment: stream }); } catch (e) { console.log(e); // if stream fails, send direct url return message.reply({ body: `Here's your ${type} 🥰\n${imageUrl}` }); } };