added --m flag

This commit is contained in:
Neko-Life 2021-08-05 16:58:08 +07:00
parent 628cc04583
commit cf9c63e5c1

View file

@ -2,7 +2,7 @@
const commando = require("@iceprod/discord.js-commando");
const emoteMessage = require("../../resources/emoteMessage");
const { ranLog, trySend, tryDelete } = require("../../resources/functions");
const { ranLog, trySend, tryDelete, getChannelMessage } = require("../../resources/functions");
module.exports = class say extends commando.Command {
constructor(client) {
@ -14,13 +14,21 @@ module.exports = class say extends commando.Command {
});
}
async run(msg, args) {
const REPLACE = args.match(/(?<!\\)--m +[^\s\n]+( +\d{17,19})?/g);
if (REPLACE.length)
for (const RE of REPLACE) {
const tar = RE.split(/ +/);
const tarMes = await getChannelMessage(msg, tar[1], tar[2]);
args = args.replace(RE, tarMes.content);
};
if (!args) args = '';
args = emoteMessage(this.client, args);
const sendThis = { content: args, disableMentions: "all" };
if (msg.member?.hasPermission('MENTION_EVERYONE')) {
sendThis.disableMentions = "none";
}
const sent = await trySend(this.client, msg, sendThis);
const sent = await trySend(this.client, msg, { content: sendThis, split: true });
if (args != '' && msg.guild && !(new RegExp("^<@\!?" + msg.client.user.id + ">\s")).test(msg.content) && msg.member.hasPermission("MANAGE_MESSAGES") && msg.guild.member(this.client.user).hasPermission("MANAGE_MESSAGES")) {
tryDelete(msg);
}