File size: 1,178 Bytes
2821330
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
const axios = require("axios");

module.exports.config = {
  name: "copilot",
  hasPermission: 0,
  version: "1.0.0",
  commandCategory: "AI",
  description: "Interact with the Copilot AI API",
  usePrefix: false,
  credits: "Jonell Magallanes",
  cooldowns: 10
};
 
module.exports.run = async function ({ api, event, args }) {
  const query = args.join(" ");
  if (!query) {
    return api.sendMessage("❌ Please provide a query!", event.threadID, event.messageID);
  }
    const l = await api.sendMessage("Loading....", event.threadID, event.messageID);
  try {
    const response = await axios.get(`https://ccprojectapis.ddns.net/api/copilot?ask=${encodeURIComponent(query)}`);
    const data = response.data;

    if (data.reply) {
      api.editMessage(`π—–π—Όπ—½π—Άπ—Ήπ—Όπ˜ π—”π—œ\n━━━━━━━━━━━━━━━━━━\n${data.reply}`, l.messageID, event.threadID, event.messageID);
    } else {
      api.editMessage("There no response from copilot GitHub", l.messageID, event.threadID, event.messageID);
    }
  } catch (error) {
    api.sendMessage(`${error.message}`, event.threadID, event.messageID);
  }
};