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

feat: implement soundmojis #1281

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

Snipy7374
Copy link
Collaborator

Summary

Checklist

  • If code changes were made, then they have been tested
    • I have updated the documentation to reflect the changes
    • I have formatted the code properly by running pdm lint
    • I have type-checked the code by running pdm pyright
  • This PR fixes an issue
  • 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, ...)

@Snipy7374 Snipy7374 added t: enhancement New feature t: api support Support of Discord API features s: waiting for api/docs Issue/PR is waiting for API support/documentation labels Jan 29, 2025
@shiftinv shiftinv added this to the disnake v2.11 milestone Feb 5, 2025
@@ -1097,6 +1097,11 @@ class Message(Hashable):
The poll contained in this message.

.. versionadded:: 2.10

soundboard_sounds: List[:class:`GuildSoundboardSound`]
A list of soundboard sounds in the message.
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
A list of soundboard sounds in the message.
A list of soundboard sounds in the message,
if the message contains soundmojis.

@@ -1200,6 +1206,11 @@ def __init__(
except AttributeError:
self.guild = state._get_guild(utils._get_as_snowflake(data, "guild_id"))

self.soundboard_sounds: List[GuildSoundboardSound] = [
GuildSoundboardSound(data=d, state=state, guild_id=self.guild.id)
Copy link
Member

Choose a reason for hiding this comment

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

this won't necessarily be the same guild (or even from any guild at all), soundmojis can be from other guilds or default sounds.

Example message data snippets:

guild sound

    "soundboard_sounds": [
        {
            "name": "test",
            "sound_id": "123123",
            "volume": 0.699999988079071,
            "emoji_id": "456456",
            "emoji_name": null,
            "guild_id": "789789",
            "available": true
        }
    ],

default sound

    "soundboard_sounds": [
        {
            "name": "airhorn",
            "sound_id": "2",
            "volume": 1.0,
            "emoji_id": null,
            "emoji_name": "🔊",
            "available": true
        }
    ],

@@ -86,6 +86,14 @@ def created_at(self) -> Optional[datetime.datetime]:
return None
return snowflake_time(self.id)

@property
def mention(self) -> str:
Copy link
Member

Choose a reason for hiding this comment

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

mention should be implemented on SoundboardSound and GuildSoundboardSound, but there isn't a use for it on partial sounds, as the guild data is just missing.

@@ -1200,6 +1206,11 @@ def __init__(
except AttributeError:
self.guild = state._get_guild(utils._get_as_snowflake(data, "guild_id"))

self.soundboard_sounds: List[GuildSoundboardSound] = [
Copy link
Member

Choose a reason for hiding this comment

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

I think we should also handle this for message updates.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
s: waiting for api/docs Issue/PR is waiting for API support/documentation t: api support Support of Discord API features t: enhancement New feature
Projects
Status: Todo
Development

Successfully merging this pull request may close these issues.

implement soundmojis
2 participants