#Embeds issue
1 messages · Page 1 of 1 (latest)
..
RangeError [EMBED_FIELD_VALUE]: MessageEmbed field values must be non-empty strings.
at Function.verifyString (C:\Users\Administrator\Desktop\Sabersunknown\node_modules\discord.js\src\util\Util.js:417:49)
at Function.normalizeField (C:\Users\Administrator\Desktop\Sabersunknown\node_modules\discord.js\src\structures\MessageEmbed.js:544:19)
at C:\Users\Administrator\Desktop\Sabersunknown\node_modules\discord.js\src\structures\MessageEmbed.js:565:14
at Array.map (<anonymous>)
at Function.normalizeFields (C:\Users\Administrator\Desktop\Sabersunknown\node_modules\discord.js\src\structures\MessageEmbed.js:564:8)
at MessageEmbed.addFields (C:\Users\Administrator\Desktop\Sabersunknown\node_modules\discord.js\src\structures\MessageEmbed.js:328:42)
at Client.<anonymous> (C:\Users\Administrator\Desktop\Sabersunknown\events\messageUpdate.js:10:7)
at Client.emit (node:events:390:28)
at Object.module.exports [as MESSAGE_UPDATE] (C:\Users\Administrator\Desktop\Sabersunknown\node_modules\discord.js\src\client\websocket\handlers\MESSAGE_UPDATE.js:14:12)
at WebSocketManager.handlePacket (C:\Users\Administrator\Desktop\Sabersunknown\node_modules\discord.js\src\client\websocket\WebSocketManager.js:351:31) {
[Symbol(code)]: 'EMBED_FIELD_VALUE'
}
The error is in your messageUpdate file, not the purge file
Oh. Let me get that
Pastebin.com is the number one paste tool since 2002. Pastebin is a website where you can store text online for a set period of time.
I bet you have MESSAGE partial active, right?
Can you elaborate? Its early afternoon and I haven't woke up
Do you know what partials are? And maybe come back when you‘re awake
Okay, Yep. Took me a minute.. I don't use partials I use intents.
const { Client, Collection } = require("discord.js");
require('dotenv').config();
const client = new Client({
intents: 32767,
});
module.exports = client;
// Global Variables
client.commands = new Collection();
client.slashCommands = new Collection();
client.config = process.env
// Initializing the project
require("./handler")(client);
client.login(client.config.token);
In that Case the Message wasn’t fully cached and the oldMesssage content is empty
I thought we skip events with partial data unless partials are enabled?
So I need to check "oldMessage" and have it return if it cant find the content??
Or use partials
I'm not recoding half my index, i'll just slap a check in there
wdym recoding half your index, you just have to enable them in the client constructor and then fetch the old message if its partial
Okay, I am now using intents + partials, How do I rework the event so that the error doesn't show anymore. This is confusing me.
is the error still the same?
yes
I don't know how to check partials though, I've never used them
one of the fields value is empty, as in it cannot get the string value because it is null or empty, I think.
Scroll up in this thread.
ohh it cannot find the old message basically
Okay, how do I make it so that it returns "Couldn't get message" instead of crashing?
module.exports = async function(client) {
const {MessageEmbed} = require('discord.js');
client.on('messageUpdate', async(oldMessage, newMessage) => { // Old message may be undefined
if (!oldMessage.author) return;
const MessageLog = client.channels.cache.get('982333334065643551');
if (!oldMessage) return MessageLog.send("Failed to get message.")
var embed = new MessageEmbed()
.setTitle('Message Edited!')
.setTimestamp()
.setColor("YELLOW")
.addFields(
{name: "Author:", value: <@${newMessage.author.id}> [\${newMessage.author.tag}`]}, {name: "Author ID:", value: ${newMessage.author.id}}, {name: 'Old Message:',value: ${oldMessage}}, {name: 'Edited Message::', value: ${newMessage}}, {name: "Channel:", value: <#${newMessage.channel.id}>`}
);
await MessageLog.send({embeds: [embed]});
});
}
look at the bold parts
the only problem with that is the fact that I need it to show the log. Its an edited message log meaning I want everything to be in it.
oldMessage ?? 'Old message not found'
or something like that
you should make sure it even is that problem and not something else
thats what I'm trying to figure out. this is messing with my mind
I was about to point that out lmao
oldMessage ?? 'Old message not found'
newMessage ?? 'New message not found'
assuming everything else is defined
i was gonna do
if(oldMessage){
embed part: ${oldMessage}
}else if(!oldMessage{
embed part: 'Couldnt get old message.'
}
happy?
No
why
now kindly stop
Thanks hairy
did it work?
did what? sorry, I'm multitasking rn. I have people messaging me on snap and I am getting a lot of phone calls
😂
this
?? basically uses the right hand variable if the left one is undefined or null
Aight, I'll try it
Nope, It did not.
I don't think thats the error, Its only showing when I run the purge command.
yes
why does your stack trace above show messageUpdate tho
deleting a message shouldnt trigger that
I couldn't tell you man.
do you have a message delete event handler
I mean, I could screenshare in a VC and show you some of the problems if you want
Yes I do.
show that one
module.exports = async function(client) {
const { MessageEmbed } = require('discord.js');
client.on("messageDelete", async (message) => {
const logchannel = client.channels.cache.get('982333334065643551');
if(message.author.bot) return;
const filteredcontent = message.content.substring(0, 25);
const newembed = new MessageEmbed({
color: "DARK_RED",
title: "Message Deleted!"
}).setFields(
{name: "Author:", value: `<@${message.author.id}> [\`${message.author.tag}\`]`},
{name: "Author ID:", value: `${message.author.id}`},
{name: "Message Content:", value: `${filteredcontent}`},
{name: "Channel:", value: `<#${message.channel.id}>`}
);
await logchannel.send({embeds: [newembed]});
});
}
filteredcontent is the problem then most likely
there is no content if the message wasnt cached
Okay, how do I fix it without losing the limit?
one sec
filteredcontent || 'Content not available'
you cant use ?? cuz substring on an empty string returns an empty string
which isnt null nor undefined
Alright, lemme try that
Popular Topics: Partial Structures