Advertisement
samiroexpikachu

Html 2 image

Jun 5th, 2024 (edited)
192
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: "h2i",
  6.     version: "1.0",
  7.     author: "Samir Œ",
  8.     countDown: 5,
  9.     role: 0,
  10.     description: {
  11.       vi: "",
  12.       en: "Create an image."
  13.     },
  14.     category: "fun",
  15.     guide: {
  16.       vi: "{pn} <text> |",
  17.       en: "{pn} <text> "
  18.     }
  19.   },
  20.  
  21.   onStart: async function ({ api, event, args, message }) {
  22.     const text = args.join(" ");
  23.    
  24.  
  25.     if (!text) {
  26.       return message.reply("Please provide a prompt.");
  27.     }
  28.  
  29.     message.reply("Initializing image, please wait...", async (err, info) => {
  30.       let id = info.messageID;
  31.       try {
  32.         const API = `https://www.samirxpikachu.run.place/html2image?html=${encodeURIComponent(text)}`;
  33.         const imageStream = await global.utils.getStreamFromURL(API);
  34.         message.unsend(id);
  35.         message.reply({
  36.           body: `  `,
  37.           attachment: imageStream
  38.         }, async (err, info) => {
  39.         });
  40.       } catch (error) {
  41.         console.error(error);
  42.         api.sendMessage(`Error: ${error}`, event.threadID);
  43.       }
  44.     });
  45.   }
  46. };
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement