CtrlK
BlogDocsLog inGet started
Tessl Logo

tessl/pypi-py-cord

A modern, async-ready Python API wrapper for Discord with comprehensive bot development features

Overall
score

93%

Overview
Eval results
Files

task.mdevals/scenario-9/

Discord File Manager Bot

A Discord bot that handles file operations through slash commands.

Capabilities

Upload Single File

  • The /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
  • The /upload command accepts an optional spoiler boolean parameter (default False). When True, the uploaded file is marked as a spoiler. @test

Upload Multiple Files

  • The /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

Display File Information

  • The /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

Implementation

@generates

API

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
    """
    pass

Dependencies { .dependencies }

py-cord { .dependency }

Provides Discord API functionality including file upload, attachment handling, and bot commands.

Install with Tessl CLI

npx tessl i tessl/pypi-py-cord

tile.json