Skip to content

Commit

Permalink
Resolve issues with ext.bridge docs (#1462)
Browse files Browse the repository at this point in the history
* Split ext/bridge/index

* More doc fixes

* Update bot.py

Co-authored-by: Dorukyum <53639936+Dorukyum@users.noreply.github.com>
  • Loading branch information
baronkobama and Dorukyum authored Jul 3, 2022
1 parent c80b39a commit c305ec6
Show file tree
Hide file tree
Showing 6 changed files with 94 additions and 64 deletions.
2 changes: 1 addition & 1 deletion discord/ext/bridge/bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def add_bridge_command(self, command: BridgeCommand):
command.add_to(self) # type: ignore

def bridge_command(self, **kwargs):
"""A shortcut decorator that invokes :func:`~.bridge_command` and adds it to
"""A shortcut decorator that invokes :func:`bridge_command` and adds it to
the internal command list via :meth:`~.Bot.add_bridge_command`.
Returns
Expand Down
2 changes: 1 addition & 1 deletion discord/ext/bridge/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ async def defer(self, *args, **kwargs) -> None:
"""|coro|
Defers the command with the respective approach to the current context. In :class:`BridgeExtContext`, this will
be :meth:`~discord.Messageable.trigger_typing` while in :class:`BridgeApplicationContext`, this will be
be :meth:`~discord.abc.Messageable.trigger_typing` while in :class:`BridgeApplicationContext`, this will be
:attr:`~.ApplicationContext.defer`.
.. note::
Expand Down
4 changes: 2 additions & 2 deletions discord/ext/bridge/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class BridgeCommand:
Parameters
----------
callback: Callable[[BridgeContext, ...], Awaitable[Any]]
callback: Callable[[:class:`.BridgeContext`, ...], Awaitable[Any]]
The callback to invoke when the command is executed. The first argument will be a :class:`BridgeContext`,
and any additional arguments will be passed to the callback. This callback must be a coroutine.
kwargs: Optional[Dict[:class:`str`, Any]]
Expand Down Expand Up @@ -108,7 +108,7 @@ def add_to(self, bot: Union[ExtBot, ExtAutoShardedBot]) -> None:
Parameters
----------
bot: Union[:class:`.ExtBot`, :class:`.ExtAutoShardedBot`]
bot: Union[:class:`.Bot`, :class:`.AutoShardedBot`]
The bot to add the command to.
"""

Expand Down
86 changes: 86 additions & 0 deletions docs/ext/bridge/api.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
.. currentmodule:: discord

API Reference
==============

The reference manual that follows details the API of Pycord's bridge command extension module.

.. note::

Using the prefixed command version (which uses the ``ext.commands`` extension) of bridge
commands in guilds requires :attr:`Intents.message_context` to be enabled.


.. _ext_bridge_api:

Bots
-----

Bot
~~~~

.. attributetable:: discord.ext.bridge.Bot

.. autoclass:: discord.ext.bridge.Bot
:members:

.. automethod:: Bot.add_bridge_command()

.. automethod:: Bot.bridge_command()
:decorator:

AutoShardedBot
~~~~~~~~~~~~~~~

.. attributetable:: discord.ext.bridge.AutoShardedBot

.. autoclass:: discord.ext.bridge.AutoShardedBot
:members:

Commands
---------

BridgeCommand
~~~~~~~~~~~~~~

.. attributetable:: discord.ext.bridge.BridgeCommand

.. autoclass:: discord.ext.bridge.BridgeCommand
:members:

.. automethod:: discord.ext.bridge.bridge_command()
:decorator:

BridgeCommand Subclasses
~~~~~~~~~~~~~~~~~~~~~~~~~

.. autoclass:: discord.ext.bridge.BridgeExtCommand
:members:

.. autoclass:: discord.ext.bridge.BridgeSlashCommand
:members:

Context
--------

BridgeContext
~~~~~~~~~~~~~~

.. attributetable:: discord.ext.bridge.BridgeContext

.. autoclass:: discord.ext.bridge.BridgeContext
:members:
:exclude-members: _respond, _defer, _edit, _get_super

BridgeContext Subclasses
~~~~~~~~~~~~~~~~~~~~~~~~~

.. attributetable:: discord.ext.bridge.BridgeApplicationContext

.. autoclass:: discord.ext.bridge.BridgeApplicationContext
:members:

.. attributetable:: discord.ext.bridge.BridgeExtContext

.. autoclass:: discord.ext.bridge.BridgeExtContext
:members:
62 changes: 3 additions & 59 deletions docs/ext/bridge/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,6 @@ This module allows using one command callback in order to make both a prefix com
This page includes the API reference/documentation for the module, but only contains a short example. For a more
detailed guide on how to use this, see our `discord.ext.bridge guide <https://guide.pycord.dev/extensions/bridge>`_.

.. note::
``ext.bridge`` requires the message content intent to be enabled, as it uses the ``ext.commands`` extension.

Example usage:

.. code-block:: python3
Expand Down Expand Up @@ -39,61 +36,8 @@ Example usage:
bot.run("TOKEN")
.. _discord_ext_bridge_api:

API Reference
===============

Bots
-----

.. attributetable:: discord.ext.bridge.Bot

.. autoclass:: discord.ext.bridge.Bot
:members:

.. automethod:: Bot.add_bridge_command()

.. automethod:: Bot.bridge_command()
:decorator:

.. attributetable:: discord.ext.bridge.AutoShardedBot

.. autoclass:: discord.ext.bridge.AutoShardedBot
:members:

Commands
---------

.. attributetable:: discord.ext.bridge.BridgeCommand

.. autoclass:: discord.ext.bridge.BridgeCommand
:members:

.. automethod:: discord.ext.bridge.bridge_command()
:decorator:

.. autoclass:: discord.ext.bridge.BridgeExtCommand
:members:

.. autoclass:: discord.ext.bridge.BridgeSlashCommand
:members:

Context
--------

.. attributetable:: discord.ext.bridge.BridgeContext

.. autoclass:: discord.ext.bridge.BridgeContext
:members:
:exclude-members: _respond, _defer, _edit, _get_super

.. attributetable:: discord.ext.bridge.BridgeApplicationContext

.. autoclass:: discord.ext.bridge.BridgeApplicationContext
:members:
.. attributetable:: discord.ext.bridge.BridgeExtContext
.. toctree::
:maxdepth: 2

.. autoclass:: discord.ext.bridge.BridgeExtContext
:members:
api
2 changes: 1 addition & 1 deletion docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ These pages go into great detail about everything the API can do.
discord.ext.commands API Reference <ext/commands/api.rst>
discord.ext.tasks API Reference <ext/tasks/index.rst>
discord.ext.pages API Reference <ext/pages/index.rst>
discord.ext.bridge API Reference <ext/bridge/index.rst>
discord.ext.bridge API Reference <ext/bridge/api.rst>

Meta
------
Expand Down

0 comments on commit c305ec6

Please sign in to comment.