File

discord_http.file module

class discord_http.file.File(data, filename=None, *, spoiler=False, title=None, description=None, duration_secs=None, waveform=None)

Bases: object

Represents a file to be uploaded to Discord.

Parameters:
spoiler

Whether the file is a spoiler.

title

The title of the file, if any.

description

The description of the file, if any.

duration_secs

The duration of the file in seconds, if applicable.

waveform

The waveform data for the file, if applicable.

data

The file data as a file-like object.

property filename: str

The filename of the file.

reset(*, seek=True) None

Reset the file buffer to the original position.

Return type:

None

Parameters:

seek (int | bool)

close() None

Close the file buffer.

Return type:

None

to_dict(index) dict

The file as a dictionary.

Parameters:

index (int) – The index of the file

Return type:

dict

Returns:

The file as a dictionary