"""The MIT License (MIT)Copyright (c) 2015-2021 RapptzCopyright (c) 2021-present Pycord DevelopmentPermission is hereby granted, free of charge, to any person obtaining acopy of this software and associated documentation files (the "Software"),to deal in the Software without restriction, including without limitationthe rights to use, copy, modify, merge, publish, distribute, sublicense,and/or sell copies of the Software, and to permit persons to whom theSoftware is furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included inall copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESSOR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISINGFROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHERDEALINGS IN THE SOFTWARE."""from__future__importannotationsfromtypingimportTYPE_CHECKINGfrom..abcimportMessageablefrom..enumsimportChannelTypefrom..mixinsimportHashablefrom..objectimportObjectifTYPE_CHECKING:from..messageimportPartialMessagefrom..stateimportConnectionState__all__=("PartialMessageable",)
[docs]classPartialMessageable(Messageable,Hashable):"""Represents a partial messageable to aid with working messageable channels when only a channel ID are present. The only way to construct this class is through :meth:`Client.get_partial_messageable`. Note that this class is trimmed down and has no rich attributes. .. versionadded:: 2.0 .. container:: operations .. describe:: x == y Checks if two partial messageables are equal. .. describe:: x != y Checks if two partial messageables are not equal. .. describe:: hash(x) Returns the partial messageable's hash. Attributes ---------- id: :class:`int` The channel ID associated with this partial messageable. type: Optional[:class:`ChannelType`] The channel type associated with this partial messageable, if given. """def__init__(self,state:ConnectionState,id:int,type:ChannelType|None=None):self._state:ConnectionState=stateself._channel:Object=Object(id=id)self.id:int=idself.type:ChannelType|None=typeasyncdef_get_channel(self)->Object:returnself._channel
[docs]defget_partial_message(self,message_id:int,/)->PartialMessage:"""Creates a :class:`PartialMessage` from the message ID. This is useful if you want to work with a message and only have its ID without doing an unnecessary API call. Parameters ---------- message_id: :class:`int` The message ID to create a partial message for. Returns ------- :class:`PartialMessage` The partial message. """from..messageimportPartialMessagereturnPartialMessage(channel=self,id=message_id)