Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,7 @@
("discord.ext.commands", "ext/commands"),
("discord.ext.tasks", "ext/tasks"),
("discord.ext.pages", "ext/pages"),
("discord.ext.bridge", "ext/bridge"),
],
}

Expand Down
93 changes: 93 additions & 0 deletions docs/ext/bridge/index.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
.. _discord_ext_bridge:

``discord.ext.bridge`` -- A module that bridges slash commands to prefixed commands
===================================================================================

.. versionadded:: 2.0

This module allows using one command callback in order to make both a prefix command and a slash command.

.. note::
``ext.bridge`` requires message content intent to be enabled in order to use it.

Example usage:

.. code-block:: python3

import discord
from discord.ext import bridge

bot = bridge.Bot(command_prefix="!")

@bot.bridge_command()
async def hello(ctx):
await ctx.respond("Hello!")

@bot.bridge_command()
async def bye(ctx):
await ctx.respond("Bye!")

@bot.bridge_command()
async def sum(ctx, first: int, second: int):
s = first + second
await ctx.respond(f"{s}")

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:

.. automethod:: Bot.add_bridge_command()

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

Commands
~~~~~~~~

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

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

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

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

.. autoclass:: discord.ext.bridge.BridgeExtContext
:members:
2 changes: 2 additions & 0 deletions docs/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ These extensions help you during development when it comes to common tasks.
ext/commands/index.rst
ext/tasks/index.rst
ext/pages/index.rst
ext/bridge/index.rst

Manuals
---------
Expand All @@ -64,6 +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>

Meta
------
Expand Down