const Discord = require('discord.js') const help = require('./helpFunctions') const client= require('./main') function moove(message, channelId) { message.react('🐮') const originalChannel = message.channel const msgToMooveId = message.reference.messageId const mentionedChannelId = channelId.substring(2, channelId.length - 1) console.log(mentionedChannelId) return; originalChannel.messages.fetch(msgToMooveId).then(msg => { if (msg.embeds.length > 0 && msg.content == '' && msg.attachments.size == 0) { client.getChannel(mentionedChannelId).send({ embeds: msg.embeds }) } else if (msg.attachments.size > 0) { let attachmentsURL = "" const originalMsgAttachments = msg.attachments.values() for (let i = 0; i < msg.attachments.size; i++) { const currAttachment = originalMsgAttachments.next().value attachmentsURL += `${currAttachment.url}\n` } let messStr = "" if (msg.content != '') { messStr = "\nMessage:\n" } newContent = `Sent by ${msg.author}\nmooved ${message.author}\n${messStr}${msg.content}\nAttachments:\n${attachmentsURL}` client.channels.cache.get(mentionedChannelId).send({ content: newContent }) if (msg.embeds.length > 0) { client.channels.cache.get(mentionedChannelId) .send({ embeds: msg.embeds }) } } else { // ? Empty, Has embeds if (msg.content == '') { client.channels.cache.get(mentionedChannelId).send({ content: `Sent by ${msg.author}\nmooved ${message.author}\nMessage:\n${msg.content}` }) } // ? Has content, No embeds else { const embed = new Discord.MessageEmbed() .setColor(help.randomColor()) .addFields() .addField('MOO', `Sent by ${msg.author}\nmooved ${message.author}`) .addField('Message', msg.content) client.channels.cache.get(mentionedChannelId).send({ embeds: [embed] }) } } setTimeout(() => msg.delete(), 3000) }) setTimeout(() => message.delete(), 3000) } module.exports = moove