Asset¶
discord_http.asset module¶
- class discord_http.asset.Asset(*, state, url, key, animated=False)¶
Bases:
objectRepresents a Discord asset (e.g. an image or video).
- Parameters:
state (DiscordAPI)
url (str)
key (str)
animated (bool)
- async save(path, *, chunk_size=8192) int¶
Fetches the file from the attachment URL and saves it locally to the path.
- Parameters:
- Return type:
- Returns:
The amount of bytes written to the file
- Raises:
FileNotFoundError – If the directory in the provided path does not exist.
HTTPException – If the asset returns anything but HTTP 2XX.