-
I think this is quite impossible to do in console as it takes some images from local, But can it be? |
Beta Was this translation helpful? Give feedback.
Answered by
rigwild
Aug 21, 2022
Replies: 1 comment
-
It is possible, but I will not include the attachment upload in the lib.
API doc: https://discord.com/developers/docs/reference#uploading-files You can also upload your image manually, then get its data in devtools at API call
{
// Attachment API response
const attachmentsRes = {
attachments: [
{
id: 114,
upload_url:
'https://discord-attachments-uploads-prd.storage.googleapis.com/445349b3-0ef1-4e9d-be5c-1e782ac91de7/2022-02-15_12-06-24.png?upload_id=ADPycdtgy9J9bNZAj695f42Wpi5iiK1wTIwuBmqLi73-usKE8SFHxPTOwk3656xEBTAjckKPAXRzDad6S43PTdNAWkcuQA7Ijtux',
upload_filename: '445349b3-0ef1-4e9d-be5c-1e782ac91de7/2022-02-15_12-06-24.png'
}
]
}
attachmentsRes.attachments.forEach(x => {
// Add `filename` required key
x.filename = 'unknown.png'
// They dont use `upload_filename` but `uploaded_filename` instead in messages API
x.uploaded_filename = x.upload_filename
})
await api.sendMessage(cid, 'hello!', false, attachmentsRes)
} To send multiple images, just repeat the process and do it yourself. Please mark as answer |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
toastyy00
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It is possible, but I will not include the attachment upload in the lib.
API doc: https://discord.com/developers/docs/reference#uploading-files
You can also upload your image manually, then get its data in devtools at API call
POST /channels/<channel_id>/attachments
and copy its response data