Issues getting message after using it once

In the following screenshots you can see a summary of what i have been abl to find out until now. - Bot starts, waits 30 minutes, gets message (ok) - Bot waits 30 minutes, gets message (fail, crash)
67 Replies
d.js toolkit
d.js toolkitā€¢9mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - āœ… Marked as resolved by OP
Black Wolf
Black WolfOPā€¢9mo ago
client.on('ready', async () => {
setInterval(async () => {
for (const [channelID, oldInvite] of map) {
...
error
}
}
}
client.on('ready', async () => {
setInterval(async () => {
for (const [channelID, oldInvite] of map) {
...
error
}
}
}
THis is the basic structure this is in
Black Wolf
Black WolfOPā€¢9mo ago
What confuses me the most that it is able to get the message fine on start of the bot. But when the second setInterval starts after 30 minutes it fails getting the message The error that i got is saying that i cannot send an embed with just a color (no description). This happens because message.embeds[0] did not return anything when i console.log message then i see that the embed is empty
felix2336
felix2336ā€¢9mo ago
i mean
const message = await channel.messages.fetch(channelID)
const message = await channel.messages.fetch(channelID)
you have to pass in a message id
Black Wolf
Black WolfOPā€¢9mo ago
its a form channel channel id = message id
felix2336
felix2336ā€¢9mo ago
aaahh alright
Black Wolf
Black WolfOPā€¢9mo ago
channel is conststently being called thing is first loop works second one fails no clue why
felix2336
felix2336ā€¢9mo ago
do you have the full error?
Black Wolf
Black WolfOPā€¢9mo ago
^ yes i do
/app/node_modules/@discordjs/rest/dist/index.js:730
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^

DiscordAPIError[50035]: Invalid Form Body
embeds[0].description[BASE_TYPE_REQUIRED]: This field is required
at handleErrors (/app/node_modules/@discordjs/rest/dist/index.js:730:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (/app/node_modules/@discordjs/rest/dist/index.js:1133:23)
at async SequentialHandler.queueRequest (/app/node_modules/@discordjs/rest/dist/index.js:963:14)
at async _REST.request (/app/node_modules/@discordjs/rest/dist/index.js:1278:22)
at async GuildMessageManager.edit (/app/node_modules/discord.js/src/managers/MessageManager.js:188:15) {
requestBody: {
files: [],
json: {
content: undefined,
tts: false,
nonce: undefined,
enforce_nonce: false,
embeds: [ { color: 16007990 } ],
components: undefined,
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: 0,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined,
thread_name: undefined,
applied_tags: undefined,
poll: undefined
}
},
rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: {
embeds: { '0': { description: { _errors: [Array] } } }
}
},
code: 50035,
status: 400,
method: 'PATCH',
url: 'https://discordproxy.local.blackwolfwoof.com/api/v10/channels/1237474875300511774/messages/1237474875300511774'
}
/app/node_modules/@discordjs/rest/dist/index.js:730
throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
^

DiscordAPIError[50035]: Invalid Form Body
embeds[0].description[BASE_TYPE_REQUIRED]: This field is required
at handleErrors (/app/node_modules/@discordjs/rest/dist/index.js:730:13)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
at async SequentialHandler.runRequest (/app/node_modules/@discordjs/rest/dist/index.js:1133:23)
at async SequentialHandler.queueRequest (/app/node_modules/@discordjs/rest/dist/index.js:963:14)
at async _REST.request (/app/node_modules/@discordjs/rest/dist/index.js:1278:22)
at async GuildMessageManager.edit (/app/node_modules/discord.js/src/managers/MessageManager.js:188:15) {
requestBody: {
files: [],
json: {
content: undefined,
tts: false,
nonce: undefined,
enforce_nonce: false,
embeds: [ { color: 16007990 } ],
components: undefined,
username: undefined,
avatar_url: undefined,
allowed_mentions: undefined,
flags: 0,
message_reference: undefined,
attachments: undefined,
sticker_ids: undefined,
thread_name: undefined,
applied_tags: undefined,
poll: undefined
}
},
rawError: {
message: 'Invalid Form Body',
code: 50035,
errors: {
embeds: { '0': { description: { _errors: [Array] } } }
}
},
code: 50035,
status: 400,
method: 'PATCH',
url: 'https://discordproxy.local.blackwolfwoof.com/api/v10/channels/1237474875300511774/messages/1237474875300511774'
}
ignore me doing if message.embeds, just soem debugging code
Black Wolf
Black WolfOPā€¢9mo ago
it fails here it gets the embed via message.embeds[0] and puts it into an embed builder then i adjust the color and send the edit
Black Wolf
Black WolfOPā€¢9mo ago
turning it red
felix2336
felix2336ā€¢9mo ago
tf am i seeing rn XD
Black Wolf
Black WolfOPā€¢9mo ago
its for a project to automatically report servers
Black Wolf
Black WolfOPā€¢9mo ago
QR / Phish / Oauth guilds.join abuse
felix2336
felix2336ā€¢9mo ago
ah hell nah
Black Wolf
Black WolfOPā€¢9mo ago
they switch vanities from server1 to server2 so i am tracking that
felix2336
felix2336ā€¢9mo ago
ye
Black Wolf
Black WolfOPā€¢9mo ago
and when that happens i just report the server :) 200/mo~ poor discord getting swamped by tickets šŸ˜‚
felix2336
felix2336ā€¢9mo ago
so you say that the embed description is needed?
Black Wolf
Black WolfOPā€¢9mo ago
yep, it complains as the get message embeds was not successful it basically returned a message with no embed if i check if it got the right message (comparing message id) it does indeed have an embed it also is able to get it after after i restart the bot but then never again until i do another restart thats what can be seen here ^
felix2336
felix2336ā€¢9mo ago
so the discord.js lib says that the description is not required
No description
Black Wolf
Black WolfOPā€¢9mo ago
still, the issue here is... where tf my embed at D: xd
felix2336
felix2336ā€¢9mo ago
hmm idk
Black Wolf
Black WolfOPā€¢9mo ago
its a very weird behaviour
felix2336
felix2336ā€¢9mo ago
xD
Black Wolf
Black WolfOPā€¢9mo ago
also odd thing is... IT WORKS ON TESTING BUT NOT ON PROD AAA so i have to test on prod each time D: If i actually comment out the edit message it runs perfectly fine :P
felix2336
felix2336ā€¢9mo ago
:kekw:
Black Wolf
Black WolfOPā€¢9mo ago
i think i have some screenshot (termux on phone) which showed me doing that but i did infact do that before and thats how i saw there is no embed 1s
Black Wolf
Black WolfOPā€¢9mo ago
Black Wolf
Black WolfOPā€¢9mo ago
this is not from cache btw, this is const message = await channel.messages.fetch(channelID) console.log(message)
felix2336
felix2336ā€¢9mo ago
did you try to use message.embeds[0].data when creating the updatedEmbed?
Black Wolf
Black WolfOPā€¢9mo ago
that is not needed, nope i did not
felix2336
felix2336ā€¢9mo ago
No description
felix2336
felix2336ā€¢9mo ago
thats when i try to use message.embeds[0] to create an embed using embedbuilder
Black Wolf
Black WolfOPā€¢9mo ago
you can pass the embed builder into an embeds: [here] as a note, my code works. Issue is only 50% of the time lol only after it just rebooted if it executes a second time it fails
felix2336
felix2336ā€¢9mo ago
fails on the message.edit right`?
Black Wolf
Black WolfOPā€¢9mo ago
yes because it only has the edited color as the get message embeds is empty hmm, cache might be fricked then for some reason anything in particular i should try to debug / show it? also i have an old messy version in my backups which worked before i re-worked my code. If you want i can dig that up and show it in comparison it will be messy code, be warned xd uhh latest, it builds the container new
felix2336
felix2336ā€¢9mo ago
i guess you can simply set the color of the embed in the message.embeds[0] thing
Black Wolf
Black WolfOPā€¢9mo ago
lemme see what package.json says this just means higher version than X right?
"dependencies": {
"better-sqlite3": "^9.6.0",
"discord.js": "^14.15.0",
"dotenv": "^16.4.5",
"quick.db": "^9.1.7"
}
"dependencies": {
"better-sqlite3": "^9.6.0",
"discord.js": "^14.15.0",
"dotenv": "^16.4.5",
"quick.db": "^9.1.7"
}
or is this sufficient
felix2336
felix2336ā€¢9mo ago
you can also type npm ls discord.js in terminal
Black Wolf
Black WolfOPā€¢9mo ago
lemme spin up the bot
felix2336
felix2336ā€¢9mo ago
have you tried to set the color without using a seperate embedbuilder?
Black Wolf
Black WolfOPā€¢9mo ago
Nope i doubt this iwll make any difference i cannot get the embed
felix2336
felix2336ā€¢9mo ago
ah true
Black Wolf
Black WolfOPā€¢9mo ago
if i can't get the embed then it won't matter how i change the color
felix2336
felix2336ā€¢9mo ago
ye
Black Wolf
Black WolfOPā€¢9mo ago
it will just shat itself then xd I guess one thing i can do is reinstall djs and get latest if that will help, no clue
felix2336
felix2336ā€¢9mo ago
npm i discord.js@latest you don't have to uninstall it
Black Wolf
Black WolfOPā€¢9mo ago
time to docker build :P
felix2336
felix2336ā€¢9mo ago
i don't know why but i hate docker xD
Black Wolf
Black WolfOPā€¢9mo ago
lol i have a hate love with it too ig
felix2336
felix2336ā€¢9mo ago
XD
Black Wolf
Black WolfOPā€¢9mo ago
especially with my nextcloud docker image šŸ’€
felix2336
felix2336ā€¢9mo ago
i am happy with my kvm server
Black Wolf
Black WolfOPā€¢9mo ago
also i hope my ratelimit is gone... i may or may not have made the time to small when testing :3 brb in 10~ minutes when i did 2 rounds in my code nope, rate limited... a
Black Wolf
Black WolfOPā€¢9mo ago
Black Wolf
Black WolfOPā€¢9mo ago
I will call it for today as idk how to fix this or what is wrong. I guess i will continue messaging here tomorrow after work if i have some time to look into it again until then i will just comment out edit message i guess gn šŸ–¤ Looks like that was it šŸ‘€, and i thought i coded in some bug šŸ˜…
Black Wolf
Black WolfOPā€¢9mo ago
https://blackwolfwoof.com/s/BxYXADJSxZtbBNA/preview - shows caching behavior in requests - successfully edits message embeds to red
Black Wolf
Black WolfOPā€¢9mo ago
Thanks a lot Qjuh šŸ–¤, i wouldn't have imagined djs having an issue which caused this

Did you find this page helpful?