Botpack / modules /commands /humanize.js
Jonell01's picture
Upload 64 files
2821330 verified
module.exports.config = {
name: "humanize",
version: "1.0.0",
hasPermssion: 0,
credits: "Modified by Jonell Magallanes",
usePrefix: false,
description: "Converts AI-like text into humanized text.",
commandCategory: "Tool",
usages: "/humanize <text> or reply to a message with /humanize",
cooldowns: 5,
};
const axios = require("axios");
module.exports.run = async ({ api, event, args }) => {
let textToHumanize = "";
if (event.type === "message_reply" && event.messageReply.body) {
textToHumanize = event.messageReply.body;
} else if (args.length > 0) {
textToHumanize = args.join(" ");
} else {
return api.sendMessage("โŒ Please provide text to humanize by either typing it or replying to a message.", event.threadID, event.messageID);
}
const hs = await api.sendMessage("Humanizing text....", event.threadID, event.messageID);
const apiUrl = `https://ccprojectsapis.zetsu.xyz/api/aihuman?text=${encodeURIComponent(textToHumanize)}`;
try {
const response = await axios.get(apiUrl);
if (response.data.error === "No") {
const humanizedText = response.data.message2 || response.data.message;
api.editMessage(`๐—›๐˜‚๐—บ๐—ฎ๐—ป๐—ถ๐˜‡๐—ฒ ๐—ง๐—ฒ๐˜…๐˜\nโ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”โ”\n${humanizedText}`, hs.messageID, event.threadID, event.messageID);
} else {
api.sendMessage("โŒ Error: Unable to process the request.", event.threadID, event.messageID);
}
} catch (error) {
api.sendMessage(`โŒ API Error: ${error.message}`, event.threadID, event.messageID);
}
};