Soundboard¶
This section documents everything related to Discord soundboards.
Discord Models¶
PartialSoundboardSound¶
- defis_default
- asyncread
- asyncsave
- asyncto_file
- class disnake.PartialSoundboardSound[source]¶
- Represents a partial soundboard sound. - Used for sounds in - VoiceChannelEffects, and as the base for full- SoundboardSound/- GuildSoundboardSoundobjects.- New in version 2.10. - x == y
- Checks if two soundboard sounds are equal. 
 - x != y
- Checks if two soundboard sounds are not equal. 
 - hash(x)
- Returns the soundboard sounds’ hash. 
 - property created_at[source]¶
- Returns the sound’s creation time in UTC. Can be - Noneif this is a default sound.- Type:
- Optional[ - datetime.datetime]
 
 - await read()[source]¶
- This function is a coroutine. - Retrieves the content of this asset as a - bytesobject.- Raises:
- DiscordException – There was no internal connection state. 
- HTTPException – Downloading the asset failed. 
- NotFound – The asset was deleted. 
 
- Returns:
- The content of the asset. 
- Return type:
 
 - await save(fp, *, seek_begin=True)[source]¶
- This function is a coroutine. - Saves this asset into a file-like object. - Parameters:
- fp (Union[ - io.BufferedIOBase,- os.PathLike]) – The file-like object to save this asset to or the filename to use. If a filename is passed then a file is created with that filename and used instead.
- seek_begin ( - bool) – Whether to seek to the beginning of the file after saving is successfully done.
 
- Raises:
- DiscordException – There was no internal connection state. 
- HTTPException – Downloading the asset failed. 
- NotFound – The asset was deleted. 
 
- Returns:
- The number of bytes written. 
- Return type:
 
 - await to_file(*, spoiler=False, filename=None, description=None)[source]¶
- This function is a coroutine. - Converts the asset into a - Filesuitable for sending via- abc.Messageable.send().- New in version 2.5. - Changed in version 2.6: Raises - TypeErrorinstead of- InvalidArgument.- Parameters:
- Raises:
- DiscordException – The asset does not have an associated state. 
- HTTPException – Downloading the asset failed. 
- NotFound – The asset was deleted. 
- TypeError – The asset is a unicode emoji or a sticker with lottie type. 
 
- Returns:
- The asset as a file suitable for sending. 
- Return type:
 
 
SoundboardSound¶
- defis_default
- asyncread
- asyncsave
- asyncto_file
- class disnake.SoundboardSound[source]¶
- Represents a soundboard sound. - New in version 2.10. - x == y
- Checks if two soundboard sounds are equal. 
 - x != y
- Checks if two soundboard sounds are not equal. 
 - hash(x)
- Returns the soundboard sounds’ hash. 
 - emoji¶
- The sound’s emoji, if any. Due to a Discord limitation, this will have an empty - nameif it is a custom- PartialEmoji.- Type:
- Optional[Union[ - Emoji,- PartialEmoji]]
 
 - property created_at[source]¶
- Returns the sound’s creation time in UTC. Can be - Noneif this is a default sound.- Type:
- Optional[ - datetime.datetime]
 
 - await read()[source]¶
- This function is a coroutine. - Retrieves the content of this asset as a - bytesobject.- Raises:
- DiscordException – There was no internal connection state. 
- HTTPException – Downloading the asset failed. 
- NotFound – The asset was deleted. 
 
- Returns:
- The content of the asset. 
- Return type:
 
 - await save(fp, *, seek_begin=True)[source]¶
- This function is a coroutine. - Saves this asset into a file-like object. - Parameters:
- fp (Union[ - io.BufferedIOBase,- os.PathLike]) – The file-like object to save this asset to or the filename to use. If a filename is passed then a file is created with that filename and used instead.
- seek_begin ( - bool) – Whether to seek to the beginning of the file after saving is successfully done.
 
- Raises:
- DiscordException – There was no internal connection state. 
- HTTPException – Downloading the asset failed. 
- NotFound – The asset was deleted. 
 
- Returns:
- The number of bytes written. 
- Return type:
 
 - await to_file(*, spoiler=False, filename=None, description=None)[source]¶
- This function is a coroutine. - Converts the asset into a - Filesuitable for sending via- abc.Messageable.send().- New in version 2.5. - Changed in version 2.6: Raises - TypeErrorinstead of- InvalidArgument.- Parameters:
- Raises:
- DiscordException – The asset does not have an associated state. 
- HTTPException – Downloading the asset failed. 
- NotFound – The asset was deleted. 
- TypeError – The asset is a unicode emoji or a sticker with lottie type. 
 
- Returns:
- The asset as a file suitable for sending. 
- Return type:
 
 
GuildSoundboardSound¶
- class disnake.GuildSoundboardSound[source]¶
- Represents a soundboard sound that belongs to a guild. - New in version 2.10. - x == y
- Checks if two soundboard sounds are equal. 
 - x != y
- Checks if two soundboard sounds are not equal. 
 - hash(x)
- Returns the soundboard sounds’ hash. 
 - emoji¶
- The sound’s emoji, if any. Due to a Discord limitation, this will have an empty - nameif it is a custom- PartialEmoji.- Type:
- Optional[Union[ - Emoji,- PartialEmoji]]
 
 - user¶
- The user that created this sound. This can only be retrieved using - Guild.fetch_soundboard_sound()/- Guild.fetch_soundboard_sounds()while having the- create_guild_expressionsor- manage_guild_expressionspermission.- Type:
- Optional[ - User]
 
 - await edit(*, name=..., volume=..., emoji=..., reason=None)[source]¶
- This function is a coroutine. - Edits a - GuildSoundboardSoundfor the guild.- You must have - manage_guild_expressionspermission to do this. If this sound was created by you,- create_guild_expressionspermission is also sufficient.- All fields are optional. - Parameters:
- name ( - str) – The sounds’s new name. Must be at least 2 characters.
- volume ( - float) – The sound’s new volume (from- 0.0to- 1.0).
- emoji (Optional[Union[ - str,- Emoji,- PartialEmoji]]) – The sound’s new emoji. Can be- None.
- reason (Optional[ - str]) – The reason for editing this sound. Shows up on the audit log.
 
- Raises:
- Forbidden – You are not allowed to edit this soundboard sound. 
- HTTPException – An error occurred editing the soundboard sound. 
 
- Returns:
- The newly modified soundboard sound. 
- Return type:
 
 - await delete(*, reason=None)[source]¶
- This function is a coroutine. - Deletes the - GuildSoundboardSoundfrom the guild.- You must have - manage_guild_expressionspermission to do this. If this sound was created by you,- create_guild_expressionspermission is also sufficient.- Parameters:
- reason (Optional[ - str]) – The reason for deleting this sound. Shows up on the audit log.
- Raises:
- Forbidden – You are not allowed to delete this soundboard sound. 
- HTTPException – An error occurred deleting the soundboard sound. 
 
 
 - property created_at[source]¶
- Returns the sound’s creation time in UTC. Can be - Noneif this is a default sound.- Type:
- Optional[ - datetime.datetime]
 
 - await read()[source]¶
- This function is a coroutine. - Retrieves the content of this asset as a - bytesobject.- Raises:
- DiscordException – There was no internal connection state. 
- HTTPException – Downloading the asset failed. 
- NotFound – The asset was deleted. 
 
- Returns:
- The content of the asset. 
- Return type:
 
 - await save(fp, *, seek_begin=True)[source]¶
- This function is a coroutine. - Saves this asset into a file-like object. - Parameters:
- fp (Union[ - io.BufferedIOBase,- os.PathLike]) – The file-like object to save this asset to or the filename to use. If a filename is passed then a file is created with that filename and used instead.
- seek_begin ( - bool) – Whether to seek to the beginning of the file after saving is successfully done.
 
- Raises:
- DiscordException – There was no internal connection state. 
- HTTPException – Downloading the asset failed. 
- NotFound – The asset was deleted. 
 
- Returns:
- The number of bytes written. 
- Return type:
 
 - await to_file(*, spoiler=False, filename=None, description=None)[source]¶
- This function is a coroutine. - Converts the asset into a - Filesuitable for sending via- abc.Messageable.send().- New in version 2.5. - Changed in version 2.6: Raises - TypeErrorinstead of- InvalidArgument.- Parameters:
- Raises:
- DiscordException – The asset does not have an associated state. 
- HTTPException – Downloading the asset failed. 
- NotFound – The asset was deleted. 
- TypeError – The asset is a unicode emoji or a sticker with lottie type. 
 
- Returns:
- The asset as a file suitable for sending. 
- Return type: