tessl install tessl/pypi-py-cord@2.6.0A modern, async-ready Python API wrapper for Discord with comprehensive bot development features
Agent Success
Agent success rate when using this tile
93%
Improvement
Agent success rate improvement when using this tile compared to baseline
1.11x
Baseline
Agent success rate without this tile
84%
A Discord bot that implements moderation commands accessible through both slash commands and traditional text prefix commands.
Implement a timeout command that temporarily restricts a user from sending messages or joining voice channels in a server.
Implement a warn command that sends a warning message to a user via direct message.
Implement an info command that displays information about a server member.
@generates
import discord
from discord.ext import bridge
# Create a bot instance that supports both slash and prefix commands
bot = bridge.Bot(command_prefix="!", intents=discord.Intents.default())
@bot.bridge_command(name="timeout", description="Timeout a member")
async def timeout(ctx: bridge.BridgeContext, member: discord.Member, minutes: int):
"""
Times out a member for the specified number of minutes.
If minutes is 0, removes the timeout.
Args:
ctx: The command context (works for both slash and prefix commands)
member: The member to timeout
minutes: Duration in minutes (0 to remove timeout)
"""
pass
@bot.bridge_command(name="warn", description="Warn a member")
async def warn(ctx: bridge.BridgeContext, member: discord.Member, reason: str):
"""
Sends a warning DM to a member.
Args:
ctx: The command context
member: The member to warn
reason: The reason for the warning
"""
pass
@bot.bridge_command(name="info", description="Display member information")
async def info(ctx: bridge.BridgeContext, member: discord.Member = None):
"""
Displays information about a member in an embed.
If no member is specified, shows info about the command invoker.
Args:
ctx: The command context
member: The member to get info about (optional, defaults to command invoker)
"""
passProvides Discord API wrapper with bridge command support for creating commands that work as both slash and prefix commands.
@satisfied-by