← back to browse
goat command

إزالة_خلفية

إزالة الخلفية

0
views
0
likes
0
installs

Aliases: rbg

raw source
const axios = require("axios");

const apiKey = "66e0cfbb-62b8-4829-90c7-c78cacc72ae2";

module.exports = {
  config: {
    name: "إزالة_خلفية",
    aliases: ["rbg"],
    version: "1.0",
    author: "nexo_here",
    category: "image",
    shortDescription: "إزالة الخلفية",
    longDescription: "إزالة الخلفية",
    guide: "{pn} [رد على صورة]"
  },

  onStart: async function({ api, event, args }) {
    try {
      let imageUrl = "";

      if (event.type === "message_reply" && event.messageReply && event.messageReply.attachments && event.messageReply.attachments.length) {
        imageUrl = event.messageReply.attachments[0].url;
      }
      else if (event.attachments && event.attachments.length) {
        imageUrl = event.attachments[0].url;
      }
      else {
        return api.sendMessage("❌ Please reply to or attach an image.", event.threadID, event.messageID);
      }

      const apiUrl = `https://kaiz-apis.gleeze.com/api/removebgv3?url=${encodeURIComponent(imageUrl)}&stream=true&apikey=${apiKey}`;

      const response = await axios({
        method: "GET",
        url: apiUrl,
        responseType: "stream"
      });

      return api.sendMessage({
        attachment: response.data
      }, event.threadID, event.messageID);

    } catch (error) {
      console.error("rbg command error:", error);
      return api.sendMessage("❌ Failed to remove background.", event.threadID, event.messageID);
    }
  }
};

View raw file