discord.ext.bridge¶
Added in version 2.0.
Dieses Modul erlaubt es einen Befehl Callback für Prefix Command und Slash Command zu nutzen. Diese Seite enthält die API Referenzen und Dokumentation für dieses Modul aber nur ein kurzes Beispiel. Für einen besseren Guide wie man das Modul nutzen kann schau dir discord.ext.bridge guide an.
Beispiel Verwendung:
import discord
from discord.ext import bridge
intents = discord.Intents.default()
intents.message_content = True
bot = bridge.Bot(command_prefix="!", intents=intents)
@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")