@@ -20,14 +20,14 @@ class SlashContext:
20
20
:ivar name: Name of the command.
21
21
:ivar subcommand_name: Subcommand of the command.
22
22
:ivar subcommand_group: Subcommand group of the command.
23
- :ivar _interaction_id : Interaction ID of the command message.
23
+ :ivar interaction_id : Interaction ID of the command message.
24
24
:ivar command_id: ID of the command.
25
- :ivar _http: :class:`.http.SlashCommandRequest` of the client.
26
25
:ivar bot: discord.py client.
26
+ :ivar _http: :class:`.http.SlashCommandRequest` of the client.
27
27
:ivar _logger: Logger instance.
28
- :ivar _deffered : Whether the command is current deffered (loading state)
28
+ :ivar deffered : Whether the command is current deffered (loading state)
29
29
:ivar _deffered_hidden: Internal var to check that state stays the same
30
- :ivar _sent : Whether you sent the initial response.
30
+ :ivar sent : Whether you sent the initial response.
31
31
:ivar guild_id: Guild ID of the command message. If the command was invoked in DM, then it is ``None``
32
32
:ivar author_id: User ID representing author of the command message.
33
33
:ivar channel_id: Channel ID representing channel of the command message.
@@ -44,13 +44,13 @@ def __init__(self,
44
44
self .name = self .command = self .invoked_with = _json ["data" ]["name" ]
45
45
self .subcommand_name = self .invoked_subcommand = self .subcommand_passed = None
46
46
self .subcommand_group = self .invoked_subcommand_group = self .subcommand_group_passed = None
47
- self ._interaction_id = _json ["id" ]
47
+ self .interaction_id = _json ["id" ]
48
48
self .command_id = _json ["data" ]["id" ]
49
49
self ._http = _http
50
50
self .bot = _discord
51
51
self ._logger = logger
52
- self ._deffered = False
53
- self ._sent = False
52
+ self .deffered = False
53
+ self .sent = False
54
54
self ._deffered_hidden = False # To check if the patch to the deffered response matches
55
55
self .guild_id = int (_json ["guild_id" ]) if "guild_id" in _json .keys () else None
56
56
self .author_id = int (_json ["member" ]["user" ]["id" ] if "member" in _json .keys () else _json ["user" ]["id" ])
@@ -86,14 +86,14 @@ async def defer(self, hidden: bool = False):
86
86
87
87
:param hidden: Whether the deffered response should be ephemeral . Default ``False``.
88
88
"""
89
- if self ._deffered or self ._sent :
89
+ if self .deffered or self .sent :
90
90
raise error .AlreadyResponded ("You have already responded to this command!" )
91
91
base = {"type" : 5 }
92
92
if hidden :
93
93
base ["data" ] = {"flags" : 64 }
94
94
self ._deffered_hidden = True
95
- await self ._http .post_initial_response (base , self ._interaction_id , self .__token )
96
- self ._deffered = True
95
+ await self ._http .post_initial_response (base , self .interaction_id , self .__token )
96
+ self .deffered = True
97
97
98
98
async def send (self ,
99
99
content : str = "" , * ,
@@ -165,29 +165,29 @@ async def send(self,
165
165
base ["flags" ] = 64
166
166
167
167
initial_message = False
168
- if not self ._sent :
168
+ if not self .sent :
169
169
initial_message = True
170
170
if files :
171
171
raise error .IncorrectFormat ("You cannot send files in the initial response!" )
172
- if self ._deffered :
172
+ if self .deffered :
173
173
if self ._deffered_hidden != hidden :
174
174
self ._logger .warning (
175
175
"Deffered response might not be what you set it to! (hidden / visible) "
176
176
"This is because it was deffered in a different state"
177
177
)
178
178
resp = await self ._http .edit (base , self .__token )
179
- self ._deffered = False
179
+ self .deffered = False
180
180
else :
181
181
json_data = {
182
182
"type" : 4 ,
183
183
"data" : base
184
184
}
185
- await self ._http .post_initial_response (json_data , self ._interaction_id , self .__token )
185
+ await self ._http .post_initial_response (json_data , self .interaction_id , self .__token )
186
186
if not hidden :
187
187
resp = await self ._http .edit ({}, self .__token )
188
188
else :
189
189
resp = {}
190
- self ._sent = True
190
+ self .sent = True
191
191
else :
192
192
resp = await self ._http .post_followup (base , self .__token , files = files )
193
193
if not hidden :
0 commit comments