const axios = require('axios'); const meta = { name: "Random Cat", description: "Fetches a random cat image.", category: "Image", path: "/randomcat?limit=", author: "ArYAN", method: "get" }; const onStart = async ({ req, res }) => { const { limit = 1 } = req.query; const API_KEY = "26769b09-70e7-409f-ac5b-7b11bfd1ea43"; const BASE_URL = "https://kaiz-apis.gleeze.com/api/randomcat"; try { const response = await axios.get(BASE_URL, { params: { limit, apikey: API_KEY } }); const imageData = response.data?.images; if (!imageData || imageData.length === 0) { return res.json({ status: false, message: "No cat images found. The API may be busy." }); } res.json({ status: true, operator: "itz Aryan", images: imageData }); } catch (error) { console.error("Error calling the API:", error.message); res.json({ status: false, message: "An error occurred while fetching the cat image from the external API." }); } }; module.exports = { meta, onStart };