const axios = require("axios");
module.exports = {
config: {
name: "chat",
version: "1.1",
author: "JARiF@Cock | Modified By NZ R ",
category: "simSimi-bn",
cooldown: 0,
role: 0,
guide: {
en: "{p}chat hi\nfor deleting: {p}chat delete hi\nfor teaching: {p}chat teach hi | hello"
}
},
makeApiRequest: async function (question) {
try {
const response = await axios.get(`https://simsimi.vyturex.com/chat?ques=${encodeURIComponent(question)}`);
return response.data;
} catch (error) {
throw error;
}
},
handleCommand: async function ({ args, message }) {
try {
const subCommand = args[0];
if (subCommand === 'teach') {
const content = args.slice(1).join(" ").split("|").map((item) => item.trim());
if (content.length < 2) {
return message.reply("Please provide both the question and the answer separated by '|'.");
}
const questi
const answer = content.slice(1).join('|');
try {
const teachUrl = `https://simsimi.vyturex.com/teach?ques=${encodeURIComponent(question)}&ans;=${encodeURIComponent(answer)}`;
const teachResp axios.get(teachUrl);
message.reply(teachResponse.data);
} catch (error) {
console.error(error);
message.reply("Try again later dear.");
}
} else if (subCommand === 'delete') {
try {
const questi ');
if (!questionToDelete) {
message.reply('Please provide the question you want to delete.');
return;
}
const deleteUrl = `https://simsimi.vyturex.com/delete?ques=${encodeURIComponent(questionToDelete)}`;
const deleteResp axios.get(deleteUrl);
message.reply(deleteResponse.data);
} catch (error) {
console.error(error);
message.reply(error.message);
}
} else {
const name = args.join(' ');
try {
const result = await this.makeApiRequest(name);
message.reply(result, (err, info) => {
global.GoatBot.onReply.set(info.messageID, {
commandName: this.config.name,
messageID: info.messageID,
author: message.senderID
});
});
} catch (error) {
console.error(error);
message.reply('Oops! An error occurred.');
}
}
} catch (error) {
message.reply('Oops! An error occurred: ' + error.message);
}
},
onStart: function ({ args, message }) {
return this.handleCommand({ args, message });
},
onReply: function ({ args, message }) {
return this.handleCommand({ args, message });
}
};
{"html5":"htmlmixed","css":"css","javascript":"javascript","php":"php","python":"python","ruby":"ruby","lua":"text\/x-lua","bash":"text\/x-sh","go":"go","c":"text\/x-csrc","cpp":"text\/x-c++src","diff":"diff","latex":"stex","sql":"sql","xml":"xml","apl":"apl","asterisk":"asterisk","c_loadrunner":"text\/x-csrc","c_mac":"text\/x-csrc","coffeescript":"text\/x-coffeescript","csharp":"text\/x-csharp","d":"d","ecmascript":"javascript","erlang":"erlang","groovy":"text\/x-groovy","haskell":"text\/x-haskell","haxe":"text\/x-haxe","html4strict":"htmlmixed","java":"text\/x-java","java5":"text\/x-java","jquery":"javascript","mirc":"mirc","mysql":"sql","ocaml":"text\/x-ocaml","pascal":"text\/x-pascal","perl":"perl","perl6":"perl","plsql":"sql","properties":"text\/x-properties","q":"text\/x-q","scala":"scala","scheme":"text\/x-scheme","tcl":"text\/x-tcl","vb":"text\/x-vb","verilog":"text\/x-verilog","yaml":"text\/x-yaml","z80":"text\/x-z80"}