diff --git a/cmds/utility/say.js b/cmds/utility/say.js index 6ea45da..7c4df27 100644 --- a/cmds/utility/say.js +++ b/cmds/utility/say.js @@ -1,6 +1,7 @@ 'use strict'; const commando = require("@iceprod/discord.js-commando"); +const emoteMessage = require("../../resources/emoteMessage"); const { ranLog, trySend, tryDelete } = require("../../resources/functions"); module.exports = class say extends commando.Command { @@ -17,6 +18,7 @@ module.exports = class say extends commando.Command { if (!args) { args = noArgs; } + args = emoteMessage(this.client, args); const sendThis = {content:args, disableMentions:"all"}; if (msg.member?.hasPermission("ADMINISTRATOR")) { sendThis.disableMentions = "none"; diff --git a/cmds/utility/send.js b/cmds/utility/send.js index 246d6f7..3365477 100644 --- a/cmds/utility/send.js +++ b/cmds/utility/send.js @@ -1,5 +1,6 @@ 'use strict'; const commando = require("@iceprod/discord.js-commando"); +const emoteMessage = require("../../resources/emoteMessage"); const { ranLog, errLog, trySend, sentAdCheck, tryReact, findChannelRegEx, cleanMentionID } = require("../../resources/functions"); module.exports = class send extends commando.Command { @@ -19,7 +20,7 @@ module.exports = class send extends commando.Command { return trySend(this.client, msg, 'Where?!?'); } const search = cleanMentionID(comarg[0]), - sendTheMes = args.slice(comarg[0].length).trim(); + sendTheMes = emoteMessage(this.client, args.slice(comarg[0].length).trim()); let channel; if (/^\d{17,19}$/.test(search)) { channel = msg.guild.channels.cache.get(search); @@ -27,7 +28,12 @@ module.exports = class send extends commando.Command { if (!channel) { channel = findChannelRegEx(msg, search, ["category", "voice"])[0]; if (!channel) { - return trySend(this.client, msg, "That channel is like your gf. Doesn't exist <:cathmmLife:772716381874946068>"); + if (this.client.owners.includes(msg.author.id)) { + channel = this.client.channels.cache.get(search); + } + if (!channel) { + return trySend(this.client, msg, "That channel is like your gf. Doesn't exist <:cathmmLife:772716381874946068>"); + } } } if (!channel.permissionsFor(msg.author).has("SEND_MESSAGES") || !channel.permissionsFor(msg.author).has("VIEW_CHANNEL")) { diff --git a/resources/emoteMessage.js b/resources/emoteMessage.js new file mode 100644 index 0000000..37e101a --- /dev/null +++ b/resources/emoteMessage.js @@ -0,0 +1,28 @@ +'use strict'; + +module.exports = function emoteMessage(client, content) { + const emotes = content.match(/(?)/g); + if (emotes.length > 0) { + let theEmotes = []; + for (const emoteName of emotes) { + let findThis = emoteName.slice(1, -1); + const findEmote = client.emojis.cache.array(); + let found; + for (const emote of findEmote) { + if (emote.name.toLowerCase() === findThis.toLowerCase()) { + found = emote; + break; + } + } + theEmotes.push(found); + } + if (theEmotes.length > 0) { + for (let index = 0; index < emotes.length; index++) { + if (theEmotes[index]) { + content = content.replace(emotes[index], `<${theEmotes[index].animated ? "a" : ""}:${theEmotes[index].name}:${theEmotes[index].id}>`); + } + } + } + } + return content; +} \ No newline at end of file