async def to_file(self, *, use_cached: bool=False, spoiler: bool=False) -> File:
    '|coro|\n\n        Converts the attachment into a :class:`File` suitable for sending via\n        :meth:`abc.Messageable.send`.\n\n        .. versionadded:: 1.3\n\n        Parameters\n        -----------\n        use_cached: :class:`bool`\n            Whether to use :attr:`proxy_url` rather than :attr:`url` when downloading\n            the attachment. This will allow attachments to be saved after deletion\n            more often, compared to the regular URL which is generally deleted right\n            after the message is deleted. Note that this can still fail to download\n            deleted attachments if too much time has passed and it does not work\n            on some types of attachments.\n\n            .. versionadded:: 1.4\n        spoiler: :class:`bool`\n            Whether the file is a spoiler.\n\n            .. versionadded:: 1.4\n\n        Raises\n        ------\n        HTTPException\n            Downloading the attachment failed.\n        Forbidden\n            You do not have permissions to access this attachment\n        NotFound\n            The attachment was deleted.\n\n        Returns\n        -------\n        :class:`File`\n            The attachment as a file suitable for sending.\n        '
    data = (await self.read(use_cached=use_cached))
    return File(io.BytesIO(data), filename=self.filename, description=self.description, spoiler=spoiler)
|coro|

Converts the attachment into a :class:`File` suitable for sending via
:meth:`abc.Messageable.send`.

.. versionadded:: 1.3

Parameters
-----------
use_cached: :class:`bool`
    Whether to use :attr:`proxy_url` rather than :attr:`url` when downloading
    the attachment. This will allow attachments to be saved after deletion
    more often, compared to the regular URL which is generally deleted right
    after the message is deleted. Note that this can still fail to download
    deleted attachments if too much time has passed and it does not work
    on some types of attachments.

    .. versionadded:: 1.4
spoiler: :class:`bool`
    Whether the file is a spoiler.

    .. versionadded:: 1.4

Raises
------
HTTPException
    Downloading the attachment failed.
Forbidden
    You do not have permissions to access this attachment
NotFound
    The attachment was deleted.

Returns
-------
:class:`File`
    The attachment as a file suitable for sending.
async def to_file(self, *, use_cached: bool=False, spoiler: bool=False) -> File:
    '|coro|\n\n        Converts the attachment into a :class:`File` suitable for sending via\n        :meth:`abc.Messageable.send`.\n\n        .. versionadded:: 1.3\n\n        Parameters\n        -----------\n        use_cached: :class:`bool`\n            Whether to use :attr:`proxy_url` rather than :attr:`url` when downloading\n            the attachment. This will allow attachments to be saved after deletion\n            more often, compared to the regular URL which is generally deleted right\n            after the message is deleted. Note that this can still fail to download\n            deleted attachments if too much time has passed and it does not work\n            on some types of attachments.\n\n            .. versionadded:: 1.4\n        spoiler: :class:`bool`\n            Whether the file is a spoiler.\n\n            .. versionadded:: 1.4\n\n        Raises\n        ------\n        HTTPException\n            Downloading the attachment failed.\n        Forbidden\n            You do not have permissions to access this attachment\n        NotFound\n            The attachment was deleted.\n\n        Returns\n        -------\n        :class:`File`\n            The attachment as a file suitable for sending.\n        '
    data = (await self.read(use_cached=use_cached))
    return File(io.BytesIO(data), filename=self.filename, description=self.description, spoiler=spoiler)