Advertisement
samiroexpikachu

Pixart

May 11th, 2024
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const axios = require('axios');
  2.  
  3. module.exports = {
  4.   config: {
  5.     name: "pixart",
  6.     aliases: ["lite"],
  7.     version: "1.0",
  8.     author: "Samir Œ",
  9.     countDown: 5,
  10.     role: 2,
  11.     shortDescription: "image generator",
  12.     longDescription: "",
  13.     category: "𝗔𝗜-𝗚𝗘𝗡𝗘𝗥𝗔𝗧𝗘𝗗",
  14.     guide: {
  15.       en: "{pn} <prompt>  "
  16.     }
  17.   },
  18.  
  19.   onStart: async function ({ message, args }) {
  20.     let prompt = args.join(" ");
  21.  
  22.     try {
  23.       const apiUrl = `https://apis-samir.onrender.com/pixart/sigma?prompt=${encodeURIComponent(prompt)}`;
  24.      
  25.       const imageStream = await global.utils.getStreamFromURL(apiUrl);
  26.  
  27.       if (!imageStream) {
  28.         return message.reply("Failed to retrieve image.");
  29.       }
  30.      
  31.       return message.reply({
  32.         body: '',
  33.         attachment: imageStream
  34.       });
  35.     } catch (error) {
  36.       console.error(error);
  37.       return message.reply("Failed to retrieve image.");
  38.     }
  39.   }
  40. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement