File tree Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Expand file tree Collapse file tree 1 file changed +13
-2
lines changed Original file line number Diff line number Diff line change 52
52
from ..role import Role
53
53
from ..object import Object
54
54
from ..channel import _guild_channel_factory
55
- from ..enums import ChannelType , SlashCommandOptionType
55
+ from ..enums import ChannelType , MessageType , SlashCommandOptionType , try_enum
56
56
from ..errors import (
57
57
ClientException ,
58
58
ValidationError ,
@@ -1418,7 +1418,18 @@ async def _invoke(self, ctx: ApplicationContext):
1418
1418
message = v
1419
1419
channel = ctx .interaction ._state .get_channel (int (message ["channel_id" ]))
1420
1420
if channel is None :
1421
- data = await ctx .interaction ._state .http .start_private_message (int (message ["author" ]["id" ]))
1421
+ author_id = int (message ["author" ]["id" ])
1422
+ self_or_system_message : bool = (
1423
+ ctx .bot .user .id == author_id
1424
+ or try_enum (MessageType , message ["type" ]) not in (
1425
+ MessageType .default ,
1426
+ MessageType .reply ,
1427
+ MessageType .application_command ,
1428
+ MessageType .thread_starter_message ,
1429
+ )
1430
+ )
1431
+ user_id = ctx .author .id if self_or_system_message else author_id
1432
+ data = await ctx .interaction ._state .http .start_private_message (user_id )
1422
1433
channel = ctx .interaction ._state .add_dm_channel (data )
1423
1434
1424
1435
target = Message (state = ctx .interaction ._state , channel = channel , data = message )
You can’t perform that action at this time.
0 commit comments