File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -21,8 +21,8 @@ class SlashContext:
21
21
:ivar logger: Logger instance.
22
22
:ivar sent: Whether you sent the initial response.
23
23
:ivar guild: :class:`discord.Guild` instance of the command message.
24
- :ivar author: :class:`discord.Member` instance representing author of the command message.
25
- :ivar channel: :class:`discord.TextChannel` instance representing channel of the command message.
24
+ :ivar author: :class:`discord.Member` instance or user ID representing author of the command message.
25
+ :ivar channel: :class:`discord.TextChannel` instance or channel ID representing channel of the command message.
26
26
"""
27
27
28
28
def __init__ (self ,
@@ -39,8 +39,14 @@ def __init__(self,
39
39
self .logger = logger
40
40
self .sent = False
41
41
self .guild : discord .Guild = _discord .get_guild (int (_json ["guild_id" ]))
42
- self .author : discord .Member = self .guild .get_member (int (_json ["member" ]["user" ]["id" ])) if self .guild else None
43
- self .channel = self .guild .get_channel (int (_json ["channel_id" ])) if self .guild else None
42
+ self .author : typing .Union [discord .Member , int ] = self .guild .get_member (int (_json ["member" ]["user" ]["id" ])) \
43
+ if self .guild else None
44
+ self .channel : typing .Union [discord .TextChannel , int ] = self .guild .get_channel (int (_json ["channel_id" ])) \
45
+ if self .guild else None
46
+ if not self .author :
47
+ self .author = int (_json ["member" ]["user" ]["id" ])
48
+ if not self .channel :
49
+ self .channel = int (_json ["channel_id" ])
44
50
45
51
async def send (self ,
46
52
send_type : int = 4 ,
You can’t perform that action at this time.
0 commit comments