aboutsummaryrefslogtreecommitdiff
path: root/discord/state.py
diff options
context:
space:
mode:
authorRapptz <[email protected]>2021-08-10 09:24:49 -0400
committerRapptz <[email protected]>2021-08-10 09:24:49 -0400
commit1279510194441135070a294254365db3dbf03897 (patch)
treed12b5f2323e1e650ebc22ae7e9d161439e18ea08 /discord/state.py
parentFill in ConnectionState.user via HTTPClient.static_login (diff)
downloaddiscord.py-1279510194441135070a294254365db3dbf03897.tar.xz
discord.py-1279510194441135070a294254365db3dbf03897.zip
Add support for PartialMessageable instances
This allows library users to send messages to channels without fetching it first.
Diffstat (limited to 'discord/state.py')
-rw-r--r--discord/state.py4
1 files changed, 2 insertions, 2 deletions
diff --git a/discord/state.py b/discord/state.py
index ca33df3d..4a09a9cc 100644
--- a/discord/state.py
+++ b/discord/state.py
@@ -405,12 +405,12 @@ class ConnectionState:
try:
guild = self._get_guild(int(data['guild_id']))
except KeyError:
- channel = DMChannel._from_message(self, channel_id)
+ channel = PartialMessageable(state=self, id=channel_id, type=ChannelType.private)
guild = None
else:
channel = guild and guild._resolve_channel(channel_id)
- return channel or Object(id=channel_id), guild
+ return channel or PartialMessageable(state=self, id=channel_id), guild
async def chunker(self, guild_id, query='', limit=0, presences=False, *, nonce=None):
ws = self._get_websocket(guild_id) # This is ignored upstream