mirror of
https://github.com/danbulant/Shasha
synced 2026-05-24 20:31:47 +00:00
32 lines
No EOL
1.3 KiB
JavaScript
32 lines
No EOL
1.3 KiB
JavaScript
'use strict';
|
|
|
|
const configFile = require("../../config.json");
|
|
const { trySend, noPerm } = require("../functions");
|
|
const { chatAnswer } = require("../shaChat");
|
|
|
|
function giveNickHeart(msg) {
|
|
if (/(?<!(remove|dont|don't|no|neve).*)(giv|put).*(heart|nick).*(nick|heart)/i.test(msg.content) && !msg.member.displayName?.endsWith("<3")) {
|
|
return msg.member.setNickname(msg.member.displayName + " <3")
|
|
.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));
|
|
}
|
|
}
|
|
|
|
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 } |