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 handles file operations through slash commands.
/upload command accepts a filepath string parameter, reads the file from the local filesystem, and sends it as an attachment. The bot responds with "File uploaded successfully." @test/upload command accepts an optional spoiler boolean parameter (default False). When True, the uploaded file is marked as a spoiler. @test/upload_many command accepts a filepaths string parameter with comma-separated paths, reads all files, and sends them as multiple attachments in a single message. @test/fileinfo command accepts a message_id integer parameter, fetches that message from the current channel, and responds with formatted text showing each attachment's filename, size in bytes, and content type. @test@generates
import discord
bot: discord.Bot
@bot.slash_command(name="upload", description="Upload a file to the channel")
async def upload(ctx: discord.ApplicationContext, filepath: str, spoiler: bool = False) -> None:
"""
Upload a file from the local filesystem to Discord.
Args:
ctx: The application context
filepath: Path to the file to upload
spoiler: Whether to mark the file as a spoiler (default: False)
"""
pass
@bot.slash_command(name="upload_many", description="Upload multiple files to the channel")
async def upload_many(ctx: discord.ApplicationContext, filepaths: str) -> None:
"""
Upload multiple files from the local filesystem to Discord in one message.
Args:
ctx: The application context
filepaths: Comma-separated file paths to upload
"""
pass
@bot.slash_command(name="fileinfo", description="Get information about attachments in a message")
async def fileinfo(ctx: discord.ApplicationContext, message_id: int) -> None:
"""
Fetch a message and display information about its attachments.
Args:
ctx: The application context
message_id: The ID of the message to inspect
"""
passProvides Discord API functionality including file upload, attachment handling, and bot commands.