Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Document voice messages. #6082

Merged
merged 3 commits into from
Apr 19, 2023
Merged

Document voice messages. #6082

merged 3 commits into from
Apr 19, 2023

Conversation

tpcstld
Copy link
Contributor

@tpcstld tpcstld commented Apr 14, 2023

Summary

Voice messages has hit a form of general availability so it's time to bust out the API docs.

One thing to note is that even though voice messages are implemented as attachments, they do not require the Attach Files permission. The gating is purely on the Send Voice Message permission.

Bots are currently not able to send voice messages, mainly as a short-term implementation detail. This will change... eventually.

I wanted to document some implementation details about voice messages, but I'm not sure where to in the docs. So I just put there where I thought makes sense lol.

Also not sure if there's additional places that I should change 🤔

| height? | ?integer | height of file (if image) |
| width? | ?integer | width of file (if image) |
| ephemeral? \* | boolean | whether this attachment is ephemeral |
| duration_secs? | integer | the duration of the audio file (currently for voice messages) |
Copy link
Contributor

@codeofandrin codeofandrin Apr 14, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
| duration_secs? | integer | the duration of the audio file (currently for voice messages) |
| duration_secs? | float | the duration of the audio file (currently for voice messages) |

duration_secs should be a float:

"content_type": "audio/ogg",
"duration_secs": 1.2999999523162842,

@Lulalaby
Copy link
Contributor

Also not sure if there's additional places that I should change

Seems to be not the case. That should be all (referencing my own implementation of voice messages).

@Misha-133
Copy link
Contributor

Shouldn't this also document the 50173 error?

{
    "message": "Cannot send voice messages in this channel",
    "code": 50173
}


- They cannot be edited.
- Only a single audio attachment is allowed. No content, stickers, etc...
- The attachment has additional fields: `duration_secs` and `waveform`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- The attachment has additional fields: `duration_secs` and `waveform`.
- The [attachment](#DOCS_RESOURCES_CHANNEL/attachment-object) object has additional fields: `duration_secs` and `waveform`.

@Lulalaby
Copy link
Contributor

Shouldn't this also document the 50173 error?

Bots are currently not able to send voice messages, mainly as a short-term implementation detail. This will change... eventually.

probably not as bots cannot encounter that atm

@Jupith
Copy link
Contributor

Jupith commented Apr 14, 2023

They can encounter it

@Misha-133
Copy link
Contributor

They can :-)
I tried sending a voice message with a bot & got this error

@Lulalaby
Copy link
Contributor

Then the error code is incorrect.
It should be something like "Bots cannot send voice messages"

@tpcstld
Copy link
Contributor Author

tpcstld commented Apr 14, 2023

In order to ease the bikeshedding of error codes here:

  1. I don't think we really document errors anymore due to the amount of possible different errors.
  2. I'm not gonna change the error message just for bots. Sorry. :P

@Jupith
Copy link
Contributor

Jupith commented Apr 14, 2023

it works with bots if you send btw x-super-properties: eyJvcyI6IldpbmRvd3MiLCJjbGllbnRfYnVpbGRfbnVtYmVyIjo5OTk5OTk5fQ==

| width? | ?integer | width of file (if image) |
| ephemeral? \* | boolean | whether this attachment is ephemeral |
| duration_secs? | float | the duration of the audio file (currently for voice messages) |
| waveform? | string | base64 encoded bytearray representing a sampled waveform (currently for voice messages) |
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would it be worthwhile to document the exact format of this data? Apparently it's 8bit 10Hz

@Rapptz
Copy link
Contributor

Rapptz commented Apr 15, 2023

In order to ease the bikeshedding of error codes here:

  1. I don't think we really document errors anymore due to the amount of possible different errors.
  2. I'm not gonna change the error message just for bots. Sorry. :P

Is this a reversal of the previous reversal? This was brought up before with its removal but it was an unpopular decision (see #4427 and its subsequent reversal).

@tpcstld
Copy link
Contributor Author

tpcstld commented Apr 18, 2023

In order to ease the bikeshedding of error codes here:

  1. I don't think we really document errors anymore due to the amount of possible different errors.
  2. I'm not gonna change the error message just for bots. Sorry. :P

Is this a reversal of the previous reversal? This was brought up before with its removal but it was an unpopular decision (see #4427 and its subsequent reversal).

No I'm just misaligned. I spoke with them and I'll sync the error codes for voice messages one time in this PR :P

@Lulalaby
Copy link
Contributor

Thank you!

@tpcstld tpcstld merged commit 70bc0f0 into main Apr 19, 2023
@tpcstld tpcstld deleted the tpcstld/voice-messages branch April 19, 2023 15:35
lukellmann added a commit to kordlib/kord that referenced this pull request Apr 20, 2023
see discord/discord-api-docs#6082

---------

Co-authored-by: Lukellmann <lukellmann@gmail.com>
TTtie added a commit to projectdysnomia/dysnomia that referenced this pull request Apr 20, 2023
* feat: voice message support

Ref: discord/discord-api-docs#6082

* keep the waveform as-is

While currently the docs specify it is a base64 byte array, it might be
more worthwhile to give the API consumer a raw string and let them deal
with it appropriately. Let alone this is probably a more future-proof
variant, as (although very unlikely) the format could change in the future.
TTtie added a commit to projectdysnomia/dysnomia that referenced this pull request Apr 20, 2023
* feat: voice message support

Ref: discord/discord-api-docs#6082

* keep the waveform as-is

While currently the docs specify it is a base64 byte array, it might be
more worthwhile to give the API consumer a raw string and let them deal
with it appropriately. Let alone this is probably a more future-proof
variant, as (although very unlikely) the format could change in the future.
kangalio added a commit to kangalio/serenity that referenced this pull request Apr 20, 2023
KubaZ2 added a commit to NetCordDev/NetCord that referenced this pull request Apr 21, 2023
arqunis pushed a commit to serenity-rs/serenity that referenced this pull request Apr 25, 2023
No breaking changes.

Newly added:
- `Attachment` fields: `duration_secs`, `waveform`
- `MessageFlags` bitflag: `IS_VOICE_MESSAGE`
- `model::Error` variant: `CannotEditVoiceMessage`
- `Permissions` bitflag: `SEND_VOICE_MESSAGES`

discord/discord-api-docs#6082
Nihlus added a commit to Remora/Remora.Discord that referenced this pull request May 1, 2023
TTtie added a commit to projectdysnomia/dysnomia that referenced this pull request May 11, 2023
* feat: voice message support

Ref: discord/discord-api-docs#6082

* keep the waveform as-is

While currently the docs specify it is a base64 byte array, it might be
more worthwhile to give the API consumer a raw string and let them deal
with it appropriately. Let alone this is probably a more future-proof
variant, as (although very unlikely) the format could change in the future.
mkrasnitski pushed a commit to mkrasnitski/serenity that referenced this pull request May 18, 2023
No breaking changes.

Newly added:
- `Attachment` fields: `duration_secs`, `waveform`
- `MessageFlags` bitflag: `IS_VOICE_MESSAGE`
- `model::Error` variant: `CannotEditVoiceMessage`
- `Permissions` bitflag: `SEND_VOICE_MESSAGES`

discord/discord-api-docs#6082
mkrasnitski pushed a commit to mkrasnitski/serenity that referenced this pull request May 19, 2023
No breaking changes.

Newly added:
- `Attachment` fields: `duration_secs`, `waveform`
- `MessageFlags` bitflag: `IS_VOICE_MESSAGE`
- `model::Error` variant: `CannotEditVoiceMessage`
- `Permissions` bitflag: `SEND_VOICE_MESSAGES`

discord/discord-api-docs#6082
mkrasnitski pushed a commit to mkrasnitski/serenity that referenced this pull request May 30, 2023
No breaking changes.

Newly added:
- `Attachment` fields: `duration_secs`, `waveform`
- `MessageFlags` bitflag: `IS_VOICE_MESSAGE`
- `model::Error` variant: `CannotEditVoiceMessage`
- `Permissions` bitflag: `SEND_VOICE_MESSAGES`

discord/discord-api-docs#6082
mkrasnitski pushed a commit to mkrasnitski/serenity that referenced this pull request Sep 21, 2023
No breaking changes.

Newly added:
- `Attachment` fields: `duration_secs`, `waveform`
- `MessageFlags` bitflag: `IS_VOICE_MESSAGE`
- `model::Error` variant: `CannotEditVoiceMessage`
- `Permissions` bitflag: `SEND_VOICE_MESSAGES`

discord/discord-api-docs#6082
mkrasnitski pushed a commit to mkrasnitski/serenity that referenced this pull request Oct 17, 2023
No breaking changes.

Newly added:
- `Attachment` fields: `duration_secs`, `waveform`
- `MessageFlags` bitflag: `IS_VOICE_MESSAGE`
- `model::Error` variant: `CannotEditVoiceMessage`
- `Permissions` bitflag: `SEND_VOICE_MESSAGES`

discord/discord-api-docs#6082
mkrasnitski pushed a commit to mkrasnitski/serenity that referenced this pull request Oct 24, 2023
No breaking changes.

Newly added:
- `Attachment` fields: `duration_secs`, `waveform`
- `MessageFlags` bitflag: `IS_VOICE_MESSAGE`
- `model::Error` variant: `CannotEditVoiceMessage`
- `Permissions` bitflag: `SEND_VOICE_MESSAGES`

discord/discord-api-docs#6082
arqunis pushed a commit to arqunis/serenity that referenced this pull request Oct 24, 2023
No breaking changes.

Newly added:
- `Attachment` fields: `duration_secs`, `waveform`
- `MessageFlags` bitflag: `IS_VOICE_MESSAGE`
- `model::Error` variant: `CannotEditVoiceMessage`
- `Permissions` bitflag: `SEND_VOICE_MESSAGES`

discord/discord-api-docs#6082
arqunis pushed a commit to arqunis/serenity that referenced this pull request Oct 24, 2023
No breaking changes.

Newly added:
- `Attachment` fields: `duration_secs`, `waveform`
- `MessageFlags` bitflag: `IS_VOICE_MESSAGE`
- `model::Error` variant: `CannotEditVoiceMessage`
- `Permissions` bitflag: `SEND_VOICE_MESSAGES`

discord/discord-api-docs#6082
shaydewael pushed a commit to Jupith/discord-api-docs that referenced this pull request May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

8 participants