discord.py icon indicating copy to clipboard operation
discord.py copied to clipboard

Support for Soundboard and VC effects

Open Puncher1 opened this issue 1 year ago • 10 comments

Summary

Last updated: Aug 15, 2024
  • Bots can receive voice channel effects over gateway events
  • Bots can receive sounds over gateway events and over API requests
  • Bots can create, edit and delete sounds
  • Bots can send sounds

This PR includes

  • Support for voice channel effects
    • VoiceChannelEffect, VoiceChannelSoundEffect, VoiceChannelEffectAnimation models
    • VoiceChannelEffectAnimationType enum
    • on_voice_channel_effect event
  • Support for soundboard sounds
    • SoundboardSound, SoundboardDefaultSound models
    • create_, edit_, delete_ sound
    • fetch_ methods (default sounds, normal sounds, specific sound)
    • Request sounds over the gateway (may be superfluous since fetch_ methods exist)
    • VoiceChannel.send_sound method
    • soundboard_sounds property and get_ methods (both for Guild and Client)
    • on_soundboard_sound_ events (create, update, delete) + GUILD_SOUNDBOARD_SOUNDS_UPDATE event (dispatches update event for every sound in the list)
  • Related Audit Log events
  • Intents.expressions -> emojis and emojis_and_stickers are now both aliases

Current Problems [solved]

All problems on Discord's side, which were stated in the related soundboard PR are fixed

  • There is no GET route for individual sounds or a guild's list of sounds. Guild sound lists can currently only be retrieved via the Gateway. GET routes should be added *
  • PATCHing a sound currently clears the sound's volume and emoji if those aren't included in the request. The PR documents this current behavior, let me know once it is fixed **
  • Looks like id and sound_id are always the same, but id is optional ***

* Now available ** The PR doesn't document this behaviour anymore *** id has been removed

Others

Default sounds are identified with an id, override_path has been removed

Related PRs: https://github.com/discord/discord-api-docs/pull/6025 (voice channel effects), https://github.com/discord/discord-api-docs/pull/6260 (soundboard)


Checklist

Testing pending

  • [x] If code changes were made then they have been tested.
    • [x] I have updated the documentation to reflect the changes.
  • [ ] This PR fixes an issue.
  • [x] This PR adds something new (e.g. new method or parameters).
  • [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • [ ] This PR is not a code change (e.g. documentation, README, ...)

Puncher1 avatar Apr 09 '23 14:04 Puncher1

When can we expect this to be undrafted and merged? @Puncher1

SvenLie avatar Jun 20 '23 16:06 SvenLie

@SvenLie The GET method is still not supported which, at least for me, doesn't make sense to merge it yet.

Puncher1 avatar Jun 20 '23 17:06 Puncher1

Update

  • For the current status, please refer to the PR description
  • The 3.x checks are failing. Looks like there's an error in the installation, @Rapptz
  • Testing is pending, after that this PR is ready for review

Puncher1 avatar Oct 29 '23 21:10 Puncher1

3.x is failing due to aiohttp not building on 3.12 and 3.x is latest Python, so CI is blocked on dependencies and not much I can do there.

Rapptz avatar Oct 29 '23 21:10 Rapptz

This has been tested and is ready for review now.

Puncher1 avatar Nov 02 '23 19:11 Puncher1

I believe the issues with 3.x have been resolved now. 🎉

PaulMarisOUMary avatar Dec 01 '23 00:12 PaulMarisOUMary

Alright I'm done with the changes. Because of the name, how about just Sound? And should it be also applied for properties and attributes (e.g. Client.soundboard_sounds -> Client.sounds)?

Puncher1 avatar Jan 27 '24 13:01 Puncher1

This will need changes because of the latests commits on the DDevs Docs PR: https://github.com/discord/discord-api-docs/pull/6260/commits/ec8656239280b89c512e92921b1e43717fcaa6c6

DA-344 avatar Jul 29 '24 21:07 DA-344

... 2. The machinery to handle opcode 31 in the gateway seems very complicated for what it is. The chunking mechanism is the way it is because it's expected that multiple events flow in and it needs to be synced and waited. I have no reason to believe soundboard sounds operate the same way but I also have no idea if they do. I tried asking to get clarification on this though I haven't gotten a response yet. I'll update you when I do.

@Rapptz You can now get soundboard sounds via GET /guilds/{guild_id}/soundboard-sounds, opcode 31 is now quite superfluous.

Edit Except for receiving sounds for multiple guilds in one request 🤷‍♂️

Puncher1 avatar Aug 06 '24 14:08 Puncher1