From 6782fd30fa86054ea88ec8d67af5ad7b6c9635af Mon Sep 17 00:00:00 2001 From: Neko Life Date: Mon, 28 Jun 2021 13:48:59 +0900 Subject: [PATCH] chat2 --- cmds/fun/chat.js | 12 ++++++------ resources/shaChat.js | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/cmds/fun/chat.js b/cmds/fun/chat.js index 5e87a6a..49571f2 100644 --- a/cmds/fun/chat.js +++ b/cmds/fun/chat.js @@ -18,12 +18,12 @@ module.exports = class chat extends commando.Command { return trySend("Ask me somethin?"); } return msg.channel.startTyping() - .then( - trySend(this.client, msg, await chatAnswer( - msg.cleanContent.slice((msg.guild.commandPrefix + msg.command.name).length + 1) + .then( + trySend(this.client, msg, await chatAnswer( + msg.cleanContent.slice((msg.guild.commandPrefix + msg.command.name).length + 1) ))).then(r => { - return r; - }).catch(() => {}) - .finally(msg.channel.stopTyping()); + return r; + }).catch(() => { }) + .finally(msg.channel.stopTyping()); } }; \ No newline at end of file diff --git a/resources/shaChat.js b/resources/shaChat.js index f45b4b2..c41c254 100644 --- a/resources/shaChat.js +++ b/resources/shaChat.js @@ -24,7 +24,7 @@ const URL = [ async function chatAnswer(message) { // return axios.post("https://rebot.me/ask", { username: "simsimi", question: message }).then(r => r.data).catch(() => { }); console.log(message); - return axios.get(`https://api.simsimi.net/v1/?text=${message.replace(/( |\n|\t)+/, "+")}&lang=en&key=API-TEST-WEB`).then(r => { + return axios.get(`https://api.simsimi.net/v1/?text=${message.replace(/( |\n|\t)+/, "+").slice(0, 1000).replace(/Sim doesn't know what you are talking about. Please teach me/, "Sorry but i don't speak gibberish")}&lang=en`).then(r => { console.log(r.data); return r.data.success; }).catch(() => { });