-
Notifications
You must be signed in to change notification settings - Fork 139
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
base: master
Are you sure you want to change the base?
Conversation
@@ -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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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) |
There was a problem hiding this comment.
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: |
There was a problem hiding this comment.
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] = [ |
There was a problem hiding this comment.
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.
Summary
Checklist
pdm lint
pdm pyright