[docs]classFile(Item[V]):"""Represents a UI File. .. note:: This component does not show media previews. Use :class:`MediaGallery` for previews instead. .. versionadded:: 2.7 Parameters ---------- url: :class:`str` The URL of this file. This must be an ``attachment://`` URL referring to a local file used with :class:`~discord.File`. spoiler: Optional[:class:`bool`] Whether this file has the spoiler overlay. id: Optional[:class:`int`] The file component's ID. """__item_repr_attributes__:tuple[str,...]=("file","spoiler","id",)def__init__(self,url:str,*,spoiler:bool=False,id:int|None=None):super().__init__()self.file=UnfurledMediaItem(url)self._underlying=FileComponent._raw_construct(type=ComponentType.file,id=id,file=self.file,spoiler=spoiler,)@propertydeftype(self)->ComponentType:returnself._underlying.type@propertydefwidth(self)->int:return5@propertydefurl(self)->str:"""The URL of this file's media. This must be an ``attachment://`` URL that references a :class:`~discord.File`."""returnself._underlying.fileandself._underlying.file.url@url.setterdefurl(self,value:str)->None:self._underlying.file.url=value@propertydefspoiler(self)->bool:"""Whether the file has the spoiler overlay. Defaults to ``False``."""returnself._underlying.spoiler@spoiler.setterdefspoiler(self,spoiler:bool)->None:self._underlying.spoiler=spoiler@propertydefname(self)->str:"""The name of this file, if provided by Discord."""returnself._underlying.name@propertydefsize(self)->int:"""The size of this file in bytes, if provided by Discord."""returnself._underlying.sizedefrefresh_component(self,component:FileComponent)->None:original=self._underlying.filecomponent.file._static_url=original._static_urlself._underlying=componentdefto_component_dict(self)->FileComponentPayload:returnself._underlying.to_dict()@classmethoddeffrom_component(cls:type[F],component:FileComponent)->F:url=component.fileandcomponent.file.urlifnoturl.startswith("attachment://"):url="attachment://"+urlparse(url).path.rsplit("/",1)[-1]returncls(url,spoiler=component.spoiler,id=component.id,)callback=None