diff --git a/cmds/fun/chat.js b/cmds/fun/chat.js index 49571f2..24e5197 100644 --- a/cmds/fun/chat.js +++ b/cmds/fun/chat.js @@ -15,15 +15,14 @@ module.exports = class chat extends commando.Command { } async run(msg, args) { if (!args) { - return trySend("Ask me somethin?"); + return trySend(msg.client, msg, "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(r => { - return r; - }).catch(() => { }) + msg.cleanContent.slice((msg.guild.commandPrefix + msg.command.name).length).trim() + )).then(r => r) + ).catch(() => { }) .finally(msg.channel.stopTyping()); } }; \ No newline at end of file diff --git a/resources/eventsLogger/message.js b/resources/eventsLogger/message.js index 105be97..3cb0fd0 100644 --- a/resources/eventsLogger/message.js +++ b/resources/eventsLogger/message.js @@ -7,27 +7,25 @@ const { chatAnswer } = require("../shaChat"); function giveNickHeart(msg) { if (/(? { - if (r) return trySend(msg.client, msg, "YES! <3 <3"); - }) - .catch(e => noPerm(msg)); + .then(r => { + if (r) return trySend(msg.client, msg, "YES! <3 <3"); + }) + .catch(e => noPerm(msg)); } if (/(dont|don't|no|neve|remove).*(giv|put)?.*(heart|nick).*(nick|heart)/i.test(msg.content) && msg.member.displayName?.endsWith(" <3")) { return msg.member.setNickname(msg.member.displayName.slice(0, -3)) - .then(r => { - if (r) return trySend(msg.client, msg, "okay <3"); - }) - .catch(e => noPerm(msg)); + .then(r => { + if (r) return trySend(msg.client, msg, "okay <3"); + }) + .catch(e => noPerm(msg)); } } async function letsChat(msg) { if (msg.channel.id === configFile.chatChannel && !msg.author.bot && !msg.isCommand && msg.cleanContent.length > 0) { - return msg.channel.startTyping().then(trySend(msg.client, msg, await chatAnswer(msg.cleanContent)) - ).then(r => { - return r; - }).catch(() => {}) - .finally(msg.channel.stopTyping()); + return msg.channel.startTyping().then(trySend(msg.client, msg, await chatAnswer(msg.cleanContent)).then(r => r) + ).catch(() => { }) + .finally(msg.channel.stopTyping()); } }