MatheX
DIAdiscord.js - Imagine an app
•Created by MatheX on 4/30/2025 in #djs-questions
message.edit is not a function
I'm developing a simple Discord bot for my classmates to manage homework assignments. The bot sends homework details as embeds. However, when I attempt to edit an existing homework embed using a button interaction and modal, I encounter the following error:
/home/matt/School/homeworkBot/responses/edit.js:84
await message.edit({embeds: [updatedEmbed], components: message.components});
^
TypeError: message.edit is not a function
at Statement.<anonymous> (/home/matt/School/homeworkBot/responses/edit.js:84:39)
at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
Node.js v18.19.0
Code Snippet:
Additional Information:
The message_id is retrieved from a database and corresponds to a message previously sent by the bot.
The bot has Administrator permissions.
The console.log(message); line outputs a valid Message object, indicating that the message is successfully fetched.
Troubleshooting Steps Taken:
Verified that the message is sent by the bot.
Confirmed that channel is a valid TextChannel instance.
Ensured that updatedEmbed is a properly constructed Embed object.
Checked that message.components is an array of MessageActionRow components.
Request:
I'm seeking assistance in identifying why message.edit is not recognized as a function, despite the message object appearing valid. Any insights or suggestions would be greatly appreciated.
5 replies