Bluecord icon indicating copy to clipboard operation
Bluecord copied to clipboard

Voice message generation

Open bluemods opened this issue 2 years ago • 1 comments

Request flow seems to be as follows:

POST => https://discord.com/api/v9/channels/{CHANNEL_ID}/attachments

BODY:

{
  "files": [
    {
      "filename": "voice-message.ogg",
      "file_size": 8987,
      "id": "2"
    }
  ]
}

RESPONSE <=

{
  "attachments": [
    {
      "id": 2,
      "upload_url": "https://discord-attachments-uploads-prd.storage.googleapis.com/{UUID}/voice-message.ogg?upload_id={UPLOAD_ID}",
      "upload_filename": "{UUID}/voice-message.ogg"
    }
  ]
}

The upload_url is then used in a PUT call:

PUT => {upload_url} from before

content-type: audio/ogg 
host: discord-attachments-uploads-prd.storage.googleapis.com
user-agent: Discord-Android/173023;RNA

The contents of the PUT is the ogg file from earlier

After that succeeds, it is followed up by this API call to send it out:

POST => https://discord.com/api/v9/channels/{CHANNEL_ID}/messages BODY:

{
  "content": "",
  "channel_id": "{CHANNEL_ID}",
  "type": 0,
  "flags": 8192,
  "attachments": [
    {
      "id": "0",
      "filename": "voice-message.ogg",
      "uploaded_filename": "{URL PATH}",
      "duration_secs": 2.48,
      "waveform": "AFZJL0FIITA3MysmLjYgNz5KNiosKSA="
    }
  ],
  "nonce": "{NONCE}"
}

Not sure how waveform is generated, but the rest makes sense enough.

bluemods avatar Apr 15 '23 04:04 bluemods

will this be included in the new bluecord update? I'm looking forward to it

void6670 avatar Apr 16 '23 17:04 void6670