kordlib / kord

Idiomatic Kotlin Wrapper for The Discord API
MIT License
926 stars 82 forks source link

Add support for sending voice messages #963

Closed marczeugs closed 3 months ago

marczeugs commented 3 months ago

As documented in the documentation bots can send voice messages by using the IS_VOICE_MESSAGE flag and setting duration_secs and waveform on audio attachments.

The voice message flag is available, but the AttachmentBuilder/AttachmentRequest classes are missing the necessary duration_secs and waveform fields.

DRSchlaubi commented 3 months ago

To me that documentation doesn't say that bots can send voice message, did I mess something

gdude2002 commented 3 months ago

As discussed on Discord, sending voice notes works just fine once you get the data figured out.

The only tricky part is calculating the waveform, but that's based on the audio data - Kord probably shouldn't be responsible for calculating it.

gdude2002 commented 3 months ago

Oh, and as for what the waveform data actually is - it's one byte per point, so it's probably just volume?

DRSchlaubi commented 3 months ago

I don't think we should add this before Discord officially supports it

Oh, and as for what the waveform data actually is - it's one byte per point, so it's probably just volume?

Always assumed it's something with volume yes

marczeugs commented 3 months ago

What counts as officially supporting it? I assumed that because the documentation explains the necessary fields, it is more or less supported?

gdude2002 commented 3 months ago

I don't see why Kord shouldn't expose this API, seems pretty easy to implement from a library perspective and it's already fully documented.

If Kord decides against this, I'll look into supporting it in KordEx.

DRSchlaubi commented 3 months ago

It is in fact not documented, what is documented is receiving voice messages, as mentioned in https://github.com/discord/discord-api-docs/pull/6082 and as in the documentation you linked being part of the "get channel message" section

Sending voice messages is documented nowhere