Skip to content
This repository was archived by the owner on Mar 8, 2022. It is now read-only.

Commit ebda421

Browse files
committed
added dmchannel autocreation to DMChannel.send()
1 parent e04ab96 commit ebda421

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

.gitignore

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,6 @@ dmypy.json
130130

131131
# visual studio
132132
.vscode/
133-
.vs/
133+
.vs/
134+
135+
internal/

discord_ui/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@
4444

4545

4646
__title__ = "discord-ui"
47-
__version__ = "4.2.2"
47+
__version__ = "4.2.3"

discord_ui/override.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,13 @@ def override_dpy():
3939

4040
#region message override
4141
async def send(self: discord.TextChannel, content=None, **kwargs) -> Message:
42-
4342
channel_id = self.id if not isinstance(self, commands.Context) else self.channel.id
43+
44+
if isinstance(self, discord.Member):
45+
if self.dm_channel == None:
46+
dm_chnl = await self.create_dm()
47+
channel_id = dm_chnl.id
48+
4449
route = BetterRoute("POST", f"/channels/{channel_id}/messages")
4550

4651
r = None

0 commit comments

Comments
 (0)