Skip to content

Commit

Permalink
Merge branch 'master' into feat/raw-presence-updated
Browse files Browse the repository at this point in the history
  • Loading branch information
elenakrittik authored Feb 5, 2024
2 parents 4d7bb6d + 0b1a047 commit aa2b5e2
Show file tree
Hide file tree
Showing 17 changed files with 169 additions and 49 deletions.
10 changes: 3 additions & 7 deletions .github/workflows/lint-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,7 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
pdm update --pre aiohttp # XXX: temporarily install aiohttp prerelease for 3.12
pdm install -d -Gspeed -Gdocs -Gvoice
run: pdm install -d -Gspeed -Gdocs -Gvoice

- name: Add .venv/bin to PATH
run: dirname "$(pdm info --python)" >> $GITHUB_PATH
Expand Down Expand Up @@ -171,13 +169,11 @@ jobs:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
pdm update --pre aiohttp # XXX: temporarily install aiohttp prerelease for 3.12
pdm install -dG test # needed for coverage
run: pdm install -dG test # needed for coverage

- name: Test package install
run: |
python -m pip install --pre . # XXX: temporarily install aiohttp prerelease for 3.12; remove --pre flag again later
python -m pip install .
- name: Run pytest
id: run_tests
Expand Down
2 changes: 1 addition & 1 deletion changelog/1045.bugfix.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
|commands| Fix incorrect typings of :meth:`~disnake.ext.commands.InvokableApplicationCommand.add_check`, :meth:`~disnake.ext.commands.InvokableApplicationCommand.remove_check`, :meth:`~disnake.ext.commands.InteractionBotBase.add_app_command_check` and :meth:`~disnake.ext.commands.InteractionBotBase.remove_app_command_check`.
|commands| Fix incorrect typings of :meth:`InvokableApplicationCommand.add_check <.ext.commands.InvokableApplicationCommand.add_check>`, :meth:`InvokableApplicationCommand.remove_check <.ext.commands.InvokableApplicationCommand.remove_check>`, :meth:`Bot.add_app_command_check <.ext.commands.Bot.add_app_command_check>` and :meth:`Bot.remove_app_command_check <.ext.commands.Bot.remove_app_command_check>`.
1 change: 1 addition & 0 deletions changelog/1077.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Add support for threads in :meth:`Webhook.fetch_message`, :meth:`~Webhook.edit_message`, and :meth:`~Webhook.delete_message`, as well as their sync counterparts.
2 changes: 1 addition & 1 deletion changelog/1111.bugfix.rst
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Allow ``cls`` argument in select menu decorators (e.g. :func`ui.string_select`) to be specified by keyword instead of being positional-only.
Allow ``cls`` argument in select menu decorators (e.g. :func:`ui.string_select`) to be specified by keyword instead of being positional-only.
1 change: 1 addition & 0 deletions changelog/1117.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support Python 3.12.
File renamed without changes.
1 change: 1 addition & 0 deletions changelog/1128.feature.1.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support Python 3.12.
1 change: 1 addition & 0 deletions changelog/1135.feature.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Support Python 3.12.
1 change: 1 addition & 0 deletions changelog/1155.bugfix.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Handle unexpected ``RECONNECT`` opcode where ``HELLO`` is expected during initial shard connection.
6 changes: 0 additions & 6 deletions disnake/abc.py
Original file line number Diff line number Diff line change
Expand Up @@ -1297,12 +1297,6 @@ async def create_invite(
max_age: :class:`int`
How long the invite should last in seconds. If set to ``0``, then the invite
doesn't expire. Defaults to ``0``.
.. warning::
If the guild is not a Community guild (has ``COMMUNITY`` in :attr:`.Guild.features`),
this must be set to a number between ``1`` and ``2592000`` seconds.
max_uses: :class:`int`
How many uses the invite could be used for. If it's 0 then there
are unlimited uses. Defaults to ``0``.
Expand Down
8 changes: 8 additions & 0 deletions disnake/ext/commands/common_bot_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,10 @@ def add_cog(self, cog: Cog, *, override: bool = False) -> None:
A cog is a class that has its own event listeners and commands.
This automatically re-syncs application commands, provided that
:attr:`command_sync_flags.sync_on_cog_actions <.CommandSyncFlags.sync_on_cog_actions>`
isn't disabled.
.. versionchanged:: 2.0
:exc:`.ClientException` is raised when a cog with the same name
Expand Down Expand Up @@ -228,6 +232,10 @@ def remove_cog(self, name: str) -> Optional[Cog]:
If no cog is found then this method has no effect.
This automatically re-syncs application commands, provided that
:attr:`command_sync_flags.sync_on_cog_actions <.CommandSyncFlags.sync_on_cog_actions>`
isn't disabled.
Parameters
----------
name: :class:`str`
Expand Down
18 changes: 18 additions & 0 deletions disnake/shard.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,16 @@ async def reidentify(self, exc: ReconnectWebSocket) -> None:
gateway=self.ws.resume_gateway if exc.resume else None,
)
self.ws = await asyncio.wait_for(coro, timeout=60.0)
# n.b. this is the same error handling as for the actual worker, but for the initial connect steps
except ReconnectWebSocket as e:
_log.debug(
"Unexpectedly received request to %s shard ID %s while attempting to %s",
e.op,
self.id,
exc.op,
)
etype = EventType.resume if e.resume else EventType.identify
self._queue_put(EventItem(etype, self, e))
except self._handled_exceptions as e:
await self._handle_disconnect(e)
except asyncio.CancelledError:
Expand All @@ -204,6 +214,14 @@ async def reconnect(self) -> None:
try:
coro = DiscordWebSocket.from_client(self._client, shard_id=self.id)
self.ws = await asyncio.wait_for(coro, timeout=60.0)
except ReconnectWebSocket as e:
_log.debug(
"Unexpectedly received request to %s shard ID %s while attempting to reconnect",
e.op,
self.id,
)
etype = EventType.resume if e.resume else EventType.identify
self._queue_put(EventItem(etype, self, e))
except self._handled_exceptions as e:
await self._handle_disconnect(e)
except asyncio.CancelledError:
Expand Down
2 changes: 1 addition & 1 deletion disnake/threads.py
Original file line number Diff line number Diff line change
Expand Up @@ -831,7 +831,7 @@ async def remove_user(self, user: Snowflake) -> None:
Parameters
----------
user: :class:`abc.Snowflake`
The user to add to the thread.
The user to remove from the thread.
Raises
------
Expand Down
2 changes: 1 addition & 1 deletion disnake/ui/select/role.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@


class RoleSelect(BaseSelect[RoleSelectMenu, "Role", V_co]):
"""Represents a UI user select menu.
"""Represents a UI role select menu.
This is usually represented as a drop down menu.
Expand Down
Loading

0 comments on commit aa2b5e2

Please sign in to comment.