Facebook
From Nafis, 1 Month ago, written in Plain Text.
Embed
Download Paste or View Raw
Hits: 143
  1. const axios = require('axios');
  2. const fs = require('fs');
  3.  
  4. module.exports = {
  5.   config: {
  6.     name: 'sdxl',
  7.     version: '1.0',
  8.     author: 'rehat--',
  9.     countDown: 0,
  10.     role: 0,
  11.     longDescription: {
  12.       en: 'Text to Image'
  13.     },
  14.     category: 'ai',
  15.     guide: {
  16.       en: '1 | DreamshaperXL10' +
  17.         '\n2 | DynavisionXL' +
  18.         '\n3 | JuggernautXL' +
  19.         '\n4 | RealismEngineSDXL' +
  20.         '\n5 | Sdxl 1.0'
  21.     }
  22.   },
  23.  
  24.   onStart: async function ({ message, args, event, api }) {
  25.     const permission = ["100044530383890","100041424796903","100037727202161"];
  26.     if (!permission.includes(event.senderID)) {
  27.       api.sendMessage(
  28.         `❌ | Command "sdxl" currently unavailable buy premium to use the command.`,
  29.         event.threadID,
  30.         event.messageID
  31.       );
  32.       return;
  33.     }
  34.     try {
  35.       const info = args.join(' ');
  36.       const [prompt, model] = info.split('|').map(item => item.trim());
  37.       const text = args.join(" ");
  38.       if (!text) {
  39.         return message.reply("❎ | Please provide a prompt");
  40.       }
  41.       const modelParam = model || '2';
  42.       const apiUrl = `https://turtle-apis.onrender.com/api/sdxl?prompt=${prompt}&model;=${modelParam}`;
  43.  
  44.       await message.reply('Please wait...⏳');
  45.  
  46.       const form = {};
  47.       form.attachment = [];
  48.       form.attachment[0] = await global.utils.getStreamFromURL(apiUrl);
  49.  
  50.       message.reply(form);
  51.     } catch (error) {
  52.       console.error(error);
  53.       await message.reply('❎ | Sorry, API has a skill issue');
  54.     }
  55.   }
  56. };