json - Turning an embedded message into non embedded message? Discord.js -
"My project that I am working on is kind of strange. I am coping messages in a server that I don't have any perms in, ""server A"", and sending them to a channel in my server ""Server B"". so if the owner of server A types ""hi"" in the channel i select, then it types ""hi"" as me but in server B. The difficulty I am having is turning an Embedded message into a non-embedded message, and vis versa. It does message to message and Embedded message to Embedded message fine but im trying to make a toggle switch. ex !embedon !embedoff. //Retrieve Embed option setting
let options = JSON.parse(fs.readFileSync(""./option.json"", ""utf8"")) setInterval(() => { options = JSON.parse(fs.readFileSync(""./option.json"", ""utf8"")) }, 5000)
//Configure Embeded Options
if (message.content == ""!embedon"") { options.type.user[0] = ""1""; fs.writeFileSync(""./option.json"", JSON.stringify(options)); return; }
if (message.content == ""!embedoff"") { options.type.user[0] = ""0""; fs.writeFileSync(""./option.json"", JSON.stringify(options)); return; }
//My options.json
{""type"":{""user"":[""0""]}}
//main code for execution
if (message.content == ""!sourcesa"") { message.delete(); fs.writeFileSync(""./copier/sources/sourcesa.json"", message.channel.id); return; } if (message.content == ""!outputsa"") { message.delete(); fs.writeFileSync(""./copier/outputs/outputsa.json"", message.channel.id); return; } const sourcesa = fs.readFileSync(""./copier/sources/sourcesa.json"", ""utf8""); const outputsa = fs.readFileSync(""./copier/outputs/outputsa.json"", ""utf8""); if (message.channel.id == sourcesa) { const d = client.channels.get(outputsa); if (message.embeds.length < 1) { d.send(message.content); } if ((options.type.user[0] = ""1"")) { if (message.embeds.length >= 1) { //console.log(message.embeds[0]); if (message.embeds[0].description !== undefined) { let desc = await message.embeds[0].description; const embed = new Discord.RichEmbed() .setColor(""#324aa8"") .setDescription(desc) .setTimestamp(); d.send(embed); } } } else { return; } }
I guess im just at a stand still on why it wont take an embedded message (description) in Server A and make it a normal message in Server B.
json discord discord.js
ShareShare a link to this question Copy linkCC BY-SA 4.0
Follow Follow this question to receive notifications
asked 5 mins ago Taylor RichTaylor Rich 1
New contributor Taylor Rich is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct."
|