Skip to content

Commit c305ec6

Browse files
Resolve issues with ext.bridge docs (#1462)
* Split ext/bridge/index * More doc fixes * Update bot.py Co-authored-by: Dorukyum <[email protected]>
1 parent c80b39a commit c305ec6

File tree

6 files changed

+94
-64
lines changed

6 files changed

+94
-64
lines changed

discord/ext/bridge/bot.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ def add_bridge_command(self, command: BridgeCommand):
5858
command.add_to(self) # type: ignore
5959

6060
def bridge_command(self, **kwargs):
61-
"""A shortcut decorator that invokes :func:`~.bridge_command` and adds it to
61+
"""A shortcut decorator that invokes :func:`bridge_command` and adds it to
6262
the internal command list via :meth:`~.Bot.add_bridge_command`.
6363
6464
Returns

discord/ext/bridge/context.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ async def defer(self, *args, **kwargs) -> None:
9797
"""|coro|
9898
9999
Defers the command with the respective approach to the current context. In :class:`BridgeExtContext`, this will
100-
be :meth:`~discord.Messageable.trigger_typing` while in :class:`BridgeApplicationContext`, this will be
100+
be :meth:`~discord.abc.Messageable.trigger_typing` while in :class:`BridgeApplicationContext`, this will be
101101
:attr:`~.ApplicationContext.defer`.
102102
103103
.. note::

discord/ext/bridge/core.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ class BridgeCommand:
6969
7070
Parameters
7171
----------
72-
callback: Callable[[BridgeContext, ...], Awaitable[Any]]
72+
callback: Callable[[:class:`.BridgeContext`, ...], Awaitable[Any]]
7373
The callback to invoke when the command is executed. The first argument will be a :class:`BridgeContext`,
7474
and any additional arguments will be passed to the callback. This callback must be a coroutine.
7575
kwargs: Optional[Dict[:class:`str`, Any]]
@@ -108,7 +108,7 @@ def add_to(self, bot: Union[ExtBot, ExtAutoShardedBot]) -> None:
108108
109109
Parameters
110110
----------
111-
bot: Union[:class:`.ExtBot`, :class:`.ExtAutoShardedBot`]
111+
bot: Union[:class:`.Bot`, :class:`.AutoShardedBot`]
112112
The bot to add the command to.
113113
"""
114114

docs/ext/bridge/api.rst

Lines changed: 86 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,86 @@
1+
.. currentmodule:: discord
2+
3+
API Reference
4+
==============
5+
6+
The reference manual that follows details the API of Pycord's bridge command extension module.
7+
8+
.. note::
9+
10+
Using the prefixed command version (which uses the ``ext.commands`` extension) of bridge
11+
commands in guilds requires :attr:`Intents.message_context` to be enabled.
12+
13+
14+
.. _ext_bridge_api:
15+
16+
Bots
17+
-----
18+
19+
Bot
20+
~~~~
21+
22+
.. attributetable:: discord.ext.bridge.Bot
23+
24+
.. autoclass:: discord.ext.bridge.Bot
25+
:members:
26+
27+
.. automethod:: Bot.add_bridge_command()
28+
29+
.. automethod:: Bot.bridge_command()
30+
:decorator:
31+
32+
AutoShardedBot
33+
~~~~~~~~~~~~~~~
34+
35+
.. attributetable:: discord.ext.bridge.AutoShardedBot
36+
37+
.. autoclass:: discord.ext.bridge.AutoShardedBot
38+
:members:
39+
40+
Commands
41+
---------
42+
43+
BridgeCommand
44+
~~~~~~~~~~~~~~
45+
46+
.. attributetable:: discord.ext.bridge.BridgeCommand
47+
48+
.. autoclass:: discord.ext.bridge.BridgeCommand
49+
:members:
50+
51+
.. automethod:: discord.ext.bridge.bridge_command()
52+
:decorator:
53+
54+
BridgeCommand Subclasses
55+
~~~~~~~~~~~~~~~~~~~~~~~~~
56+
57+
.. autoclass:: discord.ext.bridge.BridgeExtCommand
58+
:members:
59+
60+
.. autoclass:: discord.ext.bridge.BridgeSlashCommand
61+
:members:
62+
63+
Context
64+
--------
65+
66+
BridgeContext
67+
~~~~~~~~~~~~~~
68+
69+
.. attributetable:: discord.ext.bridge.BridgeContext
70+
71+
.. autoclass:: discord.ext.bridge.BridgeContext
72+
:members:
73+
:exclude-members: _respond, _defer, _edit, _get_super
74+
75+
BridgeContext Subclasses
76+
~~~~~~~~~~~~~~~~~~~~~~~~~
77+
78+
.. attributetable:: discord.ext.bridge.BridgeApplicationContext
79+
80+
.. autoclass:: discord.ext.bridge.BridgeApplicationContext
81+
:members:
82+
83+
.. attributetable:: discord.ext.bridge.BridgeExtContext
84+
85+
.. autoclass:: discord.ext.bridge.BridgeExtContext
86+
:members:

docs/ext/bridge/index.rst

Lines changed: 3 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,6 @@ This module allows using one command callback in order to make both a prefix com
99
This page includes the API reference/documentation for the module, but only contains a short example. For a more
1010
detailed guide on how to use this, see our `discord.ext.bridge guide <https://guide.pycord.dev/extensions/bridge>`_.
1111

12-
.. note::
13-
``ext.bridge`` requires the message content intent to be enabled, as it uses the ``ext.commands`` extension.
14-
1512
Example usage:
1613

1714
.. code-block:: python3
@@ -39,61 +36,8 @@ Example usage:
3936
4037
bot.run("TOKEN")
4138
42-
.. _discord_ext_bridge_api:
43-
44-
API Reference
45-
===============
46-
47-
Bots
48-
-----
49-
50-
.. attributetable:: discord.ext.bridge.Bot
51-
52-
.. autoclass:: discord.ext.bridge.Bot
53-
:members:
54-
55-
.. automethod:: Bot.add_bridge_command()
56-
57-
.. automethod:: Bot.bridge_command()
58-
:decorator:
59-
60-
.. attributetable:: discord.ext.bridge.AutoShardedBot
61-
62-
.. autoclass:: discord.ext.bridge.AutoShardedBot
63-
:members:
64-
65-
Commands
66-
---------
67-
68-
.. attributetable:: discord.ext.bridge.BridgeCommand
69-
70-
.. autoclass:: discord.ext.bridge.BridgeCommand
71-
:members:
72-
73-
.. automethod:: discord.ext.bridge.bridge_command()
74-
:decorator:
75-
76-
.. autoclass:: discord.ext.bridge.BridgeExtCommand
77-
:members:
78-
79-
.. autoclass:: discord.ext.bridge.BridgeSlashCommand
80-
:members:
81-
82-
Context
83-
--------
84-
85-
.. attributetable:: discord.ext.bridge.BridgeContext
86-
87-
.. autoclass:: discord.ext.bridge.BridgeContext
88-
:members:
89-
:exclude-members: _respond, _defer, _edit, _get_super
90-
91-
.. attributetable:: discord.ext.bridge.BridgeApplicationContext
92-
93-
.. autoclass:: discord.ext.bridge.BridgeApplicationContext
94-
:members:
9539
96-
.. attributetable:: discord.ext.bridge.BridgeExtContext
40+
.. toctree::
41+
:maxdepth: 2
9742

98-
.. autoclass:: discord.ext.bridge.BridgeExtContext
99-
:members:
43+
api

docs/index.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ These pages go into great detail about everything the API can do.
6565
discord.ext.commands API Reference <ext/commands/api.rst>
6666
discord.ext.tasks API Reference <ext/tasks/index.rst>
6767
discord.ext.pages API Reference <ext/pages/index.rst>
68-
discord.ext.bridge API Reference <ext/bridge/index.rst>
68+
discord.ext.bridge API Reference <ext/bridge/api.rst>
6969

7070
Meta
7171
------

0 commit comments

Comments
 (0)