Advertisement
samiroexpikachu

Black box ai

Oct 12th, 2023
305
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JavaScript 1.23 KB | Software | 0 0
  1.  
  2. module.exports = {
  3.     config: {
  4.         name: "box",
  5.         aliases: ["blackbox"],
  6.         version: "1.0",
  7.         author: "Samir Œ",
  8.         countDown: 5,
  9.         role: 0,
  10.         shortDescription: "ai",
  11.         longDescription: "black box",
  12.         category: "new ai",
  13.         guide:  {
  14.             vi: "{pn} text ",
  15.             en: "{pn} text"
  16.         }
  17.     },
  18.  
  19.  
  20.  
  21.   onStart: async function ({ api, event, args }) {
  22.     const axios = require("axios");
  23.     const { messageID, threadID, senderID, body } = event;
  24.     const tid = threadID;
  25.     const mid = messageID;
  26.     const q = encodeURIComponent(args.join(" "));
  27.  
  28.     if (!q) {
  29.       return api.sendMessage("[❗] - Missing input", tid, mid);
  30.     }
  31.  
  32.     try {
  33.       api.setMessageReaction("🔍", mid, (err) => {}, true);
  34.       api.sendMessage("⏳ Searching for the answer, please wait...⏳", tid, mid);
  35.  
  36.       const url = "https://useblackbox.io/chat-request-v4";
  37.  
  38.       const data = {
  39.         textInput: q,
  40.         allMessages: [{ user: q }],
  41.         stream: "",
  42.         clickedContinue: false,
  43.       };
  44.  
  45.       const response = await axios.post(url, data);
  46.  
  47.       const answer = response.data.response[0][0];
  48.  
  49.       api.sendMessage(answer, tid, mid);
  50.     } catch (error) {
  51.       api.sendMessage(error.message, tid, mid);
  52.     }
  53.   },
  54. };
  55.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement