| 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); | |
| } | |
| }; |