Attachment
Here I want to create moderation logs, well I also want to create message logs. how do you do it when a user deletes a message in the form of an image, the bot automatically copies the url of the attachment and creates a new attachment using AttachmentBuilder and sends it to the moderation logs system in the form of an embed containing the image, like the system from dyno bot.
![No description](https://cdn.answeroverflow.com/1162297915998470204/image.png)
![No description](https://cdn.answeroverflow.com/1162297916308860979/image.png)
9 Replies
- 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!I don't think you can just copy the url of the attachment
discord deletes images from deleted messages from their storage once the message is deleted
if you just copy and paste the url, nothing would appear
you would probably need to reupload it
and the message would need to be cached
so how to reupload it using AttachmentBuilder?
I am not sure if this is true but the message.attachments property should have an Buffer inside it, maybe this is still there when you use the message on messagedelete event
When you receive the message on the
messageDelete
event, it doesn't exist anymore, you can only access its data if discord.js has cached it.
Also it's pretty sketchy to log messages that users have explicitly deleted...Also it's pretty sketchy to log messages that users have explicitly deleted...logging messages is a common moderation practice almost all larger servers will do it, so they can re-construct violations, even if the person in question decides to erase their harassment etc. when they see mods coming online or similar. @GalaXd i would recommend you do not re-upload attachments, however. you can use the link, and if it expires it is gone, unless cached in the viewing moderator's cache. that is how we handle things here, for example the reason for this is abuse. if your bot re-uploads illegal content (worst-case scenario being gore and csam) it is now associated with your bot as author - which you are associated with as a user. based on your local laws re-uploading might count as re-distribution (which you really do not want to do, not just from a legal perspective, but also out of decency)
So... For example, if an image has been deleted by the user, can the link to the image still be seen for some time? Especially with the new endpoint feature for the duration of messages (attachments) from Discord
Or will it be immediately erased from the traces of the source?
Just out of curiosity. Is it illegal to save the deleted pictures(when someone deletes something illegal) on a data server(private server hosted somewhere in a data center)?
if you save end user data, that is message content or images, you have to encrypt them at rest on your device, that is part of the discord developer terms
the issue i am talking about is that you cannot control what other people upload and you move something potentially illegal (worst case being child sexual abuse material) from a domain you do not have to care about (their discord account) to a domain that is under your care, which is either your bots discord account (directly associated with your discord account) or - much worse - your own device/server you are responsible for
and possession and/or redistribution of said material can (and really should) be illegal