mirror of
https://github.com/danbulant/Shasha
synced 2026-05-24 12:22:00 +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 commando = require("@iceprod/discord.js-commando");
|
||||||
const emoteMessage = require("../../resources/emoteMessage");
|
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 {
|
module.exports = class say extends commando.Command {
|
||||||
constructor(client) {
|
constructor(client) {
|
||||||
|
|
@ -14,13 +14,21 @@ module.exports = class say extends commando.Command {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
async run(msg, args) {
|
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 = '';
|
if (!args) args = '';
|
||||||
args = emoteMessage(this.client, args);
|
args = emoteMessage(this.client, args);
|
||||||
const sendThis = { content: args, disableMentions: "all" };
|
const sendThis = { content: args, disableMentions: "all" };
|
||||||
if (msg.member?.hasPermission('MENTION_EVERYONE')) {
|
if (msg.member?.hasPermission('MENTION_EVERYONE')) {
|
||||||
sendThis.disableMentions = "none";
|
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")) {
|
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);
|
tryDelete(msg);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue