mirror of
https://github.com/danbulant/Shasha
synced 2026-05-20 04:28:47 +00:00
added --m flag
This commit is contained in:
parent
628cc04583
commit
cf9c63e5c1
1 changed files with 10 additions and 2 deletions
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue