Skip to content

Developer - Implementation of SoundboardSound #87

New issue

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

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

Already on GitHub? # to your account

Open
wants to merge 23 commits into
base: developer
Choose a base branch
from

Conversation

Cyber-Frodo
Copy link

@Cyber-Frodo Cyber-Frodo commented May 9, 2025

Summary by Sourcery

Implement Soundboard Sound functionality for Discord library, adding methods to create, update, delete, and manage soundboard sounds in guilds

New Features:

  • Add support for creating soundboard sounds in guilds
  • Implement methods to manage soundboard sounds (create, update, delete, retrieve)
  • Add gateway and HTTP support for soundboard sound operations

Enhancements:

  • Extend Discord client with soundboard sound methods
  • Add type definitions for soundboard sounds
  • Implement auto-trimming for sound files

Chores:

  • Add new dependencies like pydub for audio processing
  • Update type hints and imports across multiple files

Cyber-Frodo and others added 13 commits May 9, 2025 18:23
Signed-off-by: Cyber Frodo <57543710+Cyber-Frodo@users.noreply.github.com>
Signed-off-by: Cyber Frodo <57543710+Cyber-Frodo@users.noreply.github.com>
Signed-off-by: Cyber Frodo <57543710+Cyber-Frodo@users.noreply.github.com>
Signed-off-by: Cyber Frodo <57543710+Cyber-Frodo@users.noreply.github.com>
Signed-off-by: Cyber Frodo <57543710+Cyber-Frodo@users.noreply.github.com>
# Conflicts:
#	discord/client.py
#	discord/gateway.py
#	discord/guild.py
#	discord/http.py
#	discord/soundboard.py
#	discord/types/guild.py
#	requirements.txt
Copy link

sourcery-ai bot commented May 9, 2025

Reviewer's Guide

This pull request integrates soundboard functionality. It introduces a SoundboardSound class for audio processing (encoding to base64, auto-trimming with pydub), adds methods to the Guild class for CRUD operations via new HTTP API endpoints, and implements gateway event handling for real-time updates. A client-facing method to fetch sounds is also included.

File-Level Changes

Change Details Files
Introduced SoundboardSound class for audio processing and added Guild methods for soundboard management using new HTTP routes.
  • SoundboardSound class: Handles audio input (file, bytes, IOBase), encodes to base64 data URI, and auto-trims audio using pydub.
  • Guild class: Added methods for creating, updating, deleting, and fetching soundboard sounds, utilizing the SoundboardSound class for data preparation.
  • HTTPClient: Added new routes for all soundboard API interactions (create, update, delete, get one, get all, get default).
  • discord.types.guild: Added SoundboardSound type definition.
discord/soundboard.py
discord/guild.py
discord/http.py
discord/types/guild.py
Implemented gateway event parsing and a new opcode for soundboard interactions.
  • ConnectionState: Added new parsers (parse_soundboard_sounds, parse_guild_soundboard_sounds_update, etc.) for soundboard-related gateway events.
  • DiscordWebSocket: Added REQUEST_SOUNDBOARD_SOUNDS opcode (31) and the request_soundboard_sounds method to request sound lists from guilds.
discord/state.py
discord/gateway.py
Exposed soundboard fetching at the client level and updated dependencies.
  • Client class: Added fetch_soundboard_sounds method to retrieve all soundboard sounds for a specified guild.
  • Updated discord/__init__.py to export new soundboard components (e.g., SoundboardSound).
  • Added pydub to docs/requirements.txt as a new dependency for audio manipulation.
discord/client.py
discord/__init__.py
docs/requirements.txt
Corrected a parameter name typo in application commands.
  • Renamed inntegration_types to integration_types in MessageCommand.__init__.
discord/application_commands.py

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant