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-5/

Guild Action Logger

Build a Discord bot that logs administrative actions in a server to help server moderators track changes.

Requirements

Create a Discord bot with a /recent_actions slash command that:

  1. Fetches the 5 most recent administrative actions from the guild's audit log
  2. Displays each action in a readable format that includes:
    • The action type (e.g., "role created", "member kicked")
    • The user who performed the action
    • When the action occurred
  3. If a reason was provided for an action, displays it as well
  4. Handles the case where no actions are found gracefully

Implementation

@generates

API

import discord
from discord.ext import commands

class AuditLogger(commands.Cog):
    """Cog for logging guild administrative actions."""

    def __init__(self, bot: commands.Bot):
        """Initialize the audit logger."""
        pass

    @commands.slash_command(name="recent_actions", description="Display recent administrative actions")
    async def recent_actions(self, ctx: discord.ApplicationContext):
        """Fetch and display the 5 most recent administrative actions."""
        pass

Test Cases

  • When /recent_actions is invoked in a guild with no recent actions, the bot responds with a message indicating no actions found @test
  • When /recent_actions is invoked in a guild with 3 role creation actions, the bot displays those 3 actions with their timestamps and responsible users @test
  • When /recent_actions is invoked in a guild with 5 member kick actions that include reasons, the bot displays all 5 actions with their reasons @test

Dependencies { .dependencies }

py-cord { .dependency }

Provides Discord bot functionality and audit log access.