Skip to content

Commit 142be46

Browse files
authored
Merge pull request #785 from interactions-py/unstable
chore!: release 4.2.1
2 parents 6d4b5b8 + 836004f commit 142be46

File tree

7 files changed

+193
-109
lines changed

7 files changed

+193
-109
lines changed

CONTRIBUTING.rst

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,9 @@ the `Code of Conduct`_ from their documentation.
3434
Where to start
3535
--------------
3636
Our contributions start with an **Issue**. The issue should explain what the problem you're having is.
37-
Issues are our way and methodology of tracking bugs that may be occuring with this library. Every contributor
38-
must start with an Issue, as this helps numerous contributors and developers on various teams keep track of
39-
requests, bugs and miscellaneous details.
37+
Issues are our way and methodology of tracking bugs that may be occurring with this library. Every contributor
38+
is recommended to start with an Issue, as this helps numerous contributors and developers on various teams keep
39+
track of requests, bugs and miscellaneous details.
4040

4141
Issue specifications
4242
********************
@@ -45,7 +45,7 @@ Whenever there is an Issue created, they must follow the according criterion:
4545
- An Issue must not be a duplicate of an existing one.
4646
- A bug Issue must have all fields filled out.
4747
- A request Issue must have support from a pre-determined amount of users.
48-
- A miscellanous Issue must:
48+
- A miscellaneous Issue must:
4949
- Target a third-party repository if it is an issue correlated between the two.
5050
- Specify external issues that tie into library installation or performance.
5151

@@ -60,7 +60,7 @@ In order to create create in relevance to the issue, you start a **Pull Request*
6060
to be changed in the source, and allow other developers to contribute where needed.
6161

6262
When a PR is made, you **must** be targeting the ``unstable`` branch. This is our development branch
63-
that we use whenever we're working on any bugfixing, breaking changes and/or overall new features. Our
63+
that we use whenever we're working on any bug-fixing, breaking changes and/or overall new features. Our
6464
development workflow for changes is from this branch to ``stable``, and then from there to a release.
6565

6666
A pull request must additionally adhere to these following requirements:

interactions/api/gateway/client.py

Lines changed: 41 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -311,13 +311,47 @@ def _dispatch_event(self, event: str, data: dict) -> None: # sourcery no-metric
311311

312312
if _context.data._json.get("options"):
313313
for option in _context.data.options:
314-
315-
if option.focused:
316-
__name, _value = self.__sub_command_context(option, _context)
317-
_name += f"_{__name}" if __name else ""
318-
319-
if _value:
320-
__args.append(_value)
314+
if isinstance(option, dict):
315+
option = Option(**option)
316+
if option.type not in (
317+
OptionType.SUB_COMMAND,
318+
OptionType.SUB_COMMAND_GROUP,
319+
):
320+
if option.focused:
321+
__name, _value = self.__sub_command_context(option, _context)
322+
_name += f"_{__name}" if __name else ""
323+
if _value:
324+
__args.append(_value)
325+
326+
elif option.type == OptionType.SUB_COMMAND:
327+
for _option in option.options:
328+
if isinstance(_option, dict):
329+
_option = Option(**_option)
330+
if _option.focused:
331+
__name, _value = self.__sub_command_context(
332+
_option, _context
333+
)
334+
_name += f"_{__name}" if __name else ""
335+
if _value:
336+
__args.append(_value)
337+
break
338+
339+
elif option.type == OptionType.SUB_COMMAND_GROUP:
340+
for _option in option.options:
341+
if isinstance(_option, dict):
342+
_option = Option(**_option)
343+
for __option in _option.options:
344+
if isinstance(__option, dict):
345+
__option = Option(**__option)
346+
if __option.focused:
347+
__name, _value = self.__sub_command_context(
348+
__option, _context
349+
)
350+
_name += f"_{__name}" if __name else ""
351+
if _value:
352+
__args.append(_value)
353+
break
354+
break
321355
break
322356

323357
self._dispatch.dispatch("on_autocomplete", _context)

interactions/api/models/channel.py

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,10 @@ def __init__(self, **kwargs):
181181
else None
182182
)
183183
self.permission_overwrites = (
184-
[Overwrite(**overwrite) for overwrite in self._json.get("permission_overwrites")]
184+
[
185+
Overwrite(**overwrite) if isinstance(overwrite, dict) else overwrite
186+
for overwrite in self._json.get("permission_overwrites")
187+
]
185188
if self._json.get("permission_overwrites")
186189
else None
187190
)
@@ -349,10 +352,14 @@ async def modify(
349352
self.rate_limit_per_user if rate_limit_per_user is MISSING else rate_limit_per_user
350353
)
351354
_position = self.position if position is MISSING else position
352-
_parent_id = int(self.parent_id) if parent_id is MISSING else int(parent_id)
355+
_parent_id = (
356+
(int(self.parent_id) if self.parent_id else None)
357+
if parent_id is MISSING
358+
else int(parent_id)
359+
)
353360
_nsfw = self.nsfw if nsfw is MISSING else nsfw
354361
_permission_overwrites = (
355-
self.permission_overwrites
362+
[overwrite._json for overwrite in self.permission_overwrites]
356363
if permission_overwrites is MISSING
357364
else [overwrite._json for overwrite in permission_overwrites]
358365
)

interactions/api/models/guild.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -834,10 +834,12 @@ async def modify_channel(
834834
ch.rate_limit_per_user if rate_limit_per_user is MISSING else rate_limit_per_user
835835
)
836836
_position = ch.position if position is MISSING else position
837-
_parent_id = ch.parent_id if parent_id is MISSING else parent_id
837+
_parent_id = (
838+
(int(ch.parent_id) if ch.parent_id else None) if parent_id is MISSING else parent_id
839+
)
838840
_nsfw = ch.nsfw if nsfw is MISSING else nsfw
839841
_permission_overwrites = (
840-
ch.permission_overwrites
842+
[overwrite._json for overwrite in ch.permission_overwrites]
841843
if permission_overwrites is MISSING
842844
else [overwrite._json for overwrite in permission_overwrites]
843845
)

interactions/api/models/misc.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def __init__(self, **kwargs):
4646
# else case if the mixin is used outside of this library and/or SDK.
4747
setattr(self, key, kwargs[key])
4848
else:
49-
log.info(
49+
log.debug(
5050
f"Attribute {key} is missing from the {self.__class__.__name__} data model, skipping."
5151
)
5252
# work on message printout? Effective, but I think it should be a little bit more friendly

0 commit comments

Comments
 (0)