or run

tessl search
Log in

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/py-cord@2.6.x
tile.json

tessl/pypi-py-cord

tessl install tessl/pypi-py-cord@2.6.0

A 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%

task.mdevals/scenario-9/

Discord Server Setup Bot

Build a Discord bot that automates the initial setup of a new server with a comprehensive structure of channels, roles, and permissions.

Overview

You need to create a bot that can set up a Discord server with a predefined structure. The bot should respond to a slash command that creates multiple channels organized in categories, sets up roles with specific permissions, and applies appropriate permission overwrites to channels.

Requirements

Server Setup Command

Create a slash command /setup that performs the following operations:

  1. Create Roles: Create three roles in the server:

    • "Moderator" role with manage messages and kick members permissions
    • "Member" role with basic permissions (send messages, read message history)
    • "Guest" role with read-only permissions
  2. Create Channel Categories: Create two category channels:

    • "General" category
    • "Staff" category
  3. Create Text Channels: Create the following text channels:

    • "welcome" channel in the General category (read-only for everyone except Moderators)
    • "chat" channel in the General category (accessible to Members and Moderators)
    • "mod-chat" channel in the Staff category (only accessible to Moderators)
  4. Apply Permissions: Configure channel permissions appropriately:

    • The "welcome" channel should deny @everyone from sending messages but allow reading
    • The "chat" channel should allow Members and Moderators to send messages
    • The "mod-chat" channel should only be visible to users with the Moderator role
  5. Response: After completing the setup, the bot should respond to the command with a summary message listing all created roles and channels.

Error Handling

The bot should handle common errors gracefully:

  • If the bot lacks sufficient permissions, respond with an appropriate error message
  • If a role or channel with the same name already exists, skip creating it and continue with the setup

Implementation

@generates

API

import discord
from discord.ext import commands

# Bot instance with required intents
bot: discord.Bot

# Slash command handler that sets up the server structure
async def setup(ctx: discord.ApplicationContext) -> None:
    """
    Sets up the server with predefined roles, categories, and channels.
    Responds with a summary of created elements.
    """
    pass

Test Cases

  • When the /setup command is invoked in a server, it creates three roles: "Moderator", "Member", and "Guest" @test
  • When the /setup command is invoked, it creates two categories: "General" and "Staff" @test
  • When the /setup command is invoked, it creates three text channels: "welcome", "chat", and "mod-chat" in their respective categories @test
  • The "welcome" channel has permissions configured so @everyone cannot send messages but can read @test

Dependencies { .dependencies }

py-cord { .dependency }

Provides Discord bot functionality and guild management capabilities.

@satisfied-by