Skip to content

Commit f013df4

Browse files
Make sent, id, deffered not protected
1 parent 8ceecc4 commit f013df4

File tree

1 file changed

+15
-15
lines changed

1 file changed

+15
-15
lines changed

discord_slash/context.py

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ class SlashContext:
2020
:ivar name: Name of the command.
2121
:ivar subcommand_name: Subcommand of the command.
2222
: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.
2424
:ivar command_id: ID of the command.
25-
:ivar _http: :class:`.http.SlashCommandRequest` of the client.
2625
:ivar bot: discord.py client.
26+
:ivar _http: :class:`.http.SlashCommandRequest` of the client.
2727
: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)
2929
: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.
3131
:ivar guild_id: Guild ID of the command message. If the command was invoked in DM, then it is ``None``
3232
:ivar author_id: User ID representing author of the command message.
3333
:ivar channel_id: Channel ID representing channel of the command message.
@@ -44,13 +44,13 @@ def __init__(self,
4444
self.name = self.command = self.invoked_with = _json["data"]["name"]
4545
self.subcommand_name = self.invoked_subcommand = self.subcommand_passed = None
4646
self.subcommand_group = self.invoked_subcommand_group = self.subcommand_group_passed = None
47-
self._interaction_id = _json["id"]
47+
self.interaction_id = _json["id"]
4848
self.command_id = _json["data"]["id"]
4949
self._http = _http
5050
self.bot = _discord
5151
self._logger = logger
52-
self._deffered = False
53-
self._sent = False
52+
self.deffered = False
53+
self.sent = False
5454
self._deffered_hidden = False # To check if the patch to the deffered response matches
5555
self.guild_id = int(_json["guild_id"]) if "guild_id" in _json.keys() else None
5656
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):
8686
8787
:param hidden: Whether the deffered response should be ephemeral . Default ``False``.
8888
"""
89-
if self._deffered or self._sent:
89+
if self.deffered or self.sent:
9090
raise error.AlreadyResponded("You have already responded to this command!")
9191
base = {"type": 5}
9292
if hidden:
9393
base["data"] = {"flags": 64}
9494
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
9797

9898
async def send(self,
9999
content: str = "", *,
@@ -165,29 +165,29 @@ async def send(self,
165165
base["flags"] = 64
166166

167167
initial_message = False
168-
if not self._sent:
168+
if not self.sent:
169169
initial_message = True
170170
if files:
171171
raise error.IncorrectFormat("You cannot send files in the initial response!")
172-
if self._deffered:
172+
if self.deffered:
173173
if self._deffered_hidden != hidden:
174174
self._logger.warning(
175175
"Deffered response might not be what you set it to! (hidden / visible) "
176176
"This is because it was deffered in a different state"
177177
)
178178
resp = await self._http.edit(base, self.__token)
179-
self._deffered = False
179+
self.deffered = False
180180
else:
181181
json_data = {
182182
"type": 4,
183183
"data": base
184184
}
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)
186186
if not hidden:
187187
resp = await self._http.edit({}, self.__token)
188188
else:
189189
resp = {}
190-
self._sent = True
190+
self.sent = True
191191
else:
192192
resp = await self._http.post_followup(base, self.__token, files=files)
193193
if not hidden:

0 commit comments

Comments
 (0)