'use strict'; const configFile = require("../../config.json"); const { trySend, noPerm } = require("../functions"); const { chatAnswer } = require("../shaChat"); function giveNickHeart(msg) { if (/(? { 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)); } } 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 => r) ).catch(() => { }) .finally(msg.channel.stopTyping()); } } module.exports = { letsChat, giveNickHeart }