This commit is contained in:
Neko Life 2021-06-28 18:45:36 +09:00
parent bcc9793a15
commit a4d9d86dfe
2 changed files with 9 additions and 3 deletions

View file

@ -21,6 +21,7 @@ const { join } = require('path');
const getColor = require("./resources/getColor");
const { timestampAt } = require("./resources/debug");
const requireAll = require("require-all");
const { chatAnswer } = require("./resources/shaChat");
const lgr = requireAll({ dirname: join(__dirname, "resources/eventsLogger"), recursive: true });
client.functions = requireAll({ dirname: join(__dirname, "resources"), recursive: true });
@ -58,6 +59,11 @@ client.on("message", async msg => {
if (!msg.author.dbLoaded && !msg.author.bot) await msg.author.dbLoad();
lgr.message.letsChat(msg);
if (msg.mentions.has(client.user) && !msg.isCommand && msg.cleanContent?.length > 0) {
const u = msg.cleanContent.replace(new RegExp(" ?<@!?" + client.user.id + ">"), "").trim();
trySend(client, msg, await chatAnswer(u));
}
if (!msg.guild) {
//console.log(`(${msg.channel.recipient.id}) ${msg.channel.recipient.tag}: (${msg.author.id}) ${msg.author.tag}: ${msg.content}`);
} else {

View file

@ -16,12 +16,12 @@ module.exports = class say extends commando.Command {
async run(msg, args) {
if (!args) args = '';
args = emoteMessage(this.client, args);
const sendThis = {content:args, disableMentions:"all"};
const sendThis = { content: args, disableMentions: "all" };
if (msg.member?.hasPermission('MENTION_EVERYONE')) {
sendThis.disableMentions = "none";
sendThis.disableMentions = "none";
}
const sent = await trySend(this.client, msg, sendThis);
if (args != '' && msg.channel.guild && msg.member.hasPermission("MANAGE_MESSAGES")) {
if (args != '' && msg.channel.guild && msg.member.hasPermission("MANAGE_MESSAGES") && !/^<@\!?\d{17,19}>\s.+/.test(msg.content)) {
tryDelete(msg);
}
ranLog(msg, sent.content);