Skip to main content

Dataclass-driven Discord API Wrapper in Python

Project description

ScurryPy

PyPI version Discord

Fire-breathing squirrel

Clarity over magic: build a bot that lasts ✨

Features

  • Lightweight core
  • Rate limit handling
  • Automatic session & gateway management
  • Automatic sharding
  • Predictable event models and resource classes

Your focus is building what you want instead of fighting a framework.

Installation

Install ScurryPy with pip:

pip install scurrypy

Examples

The following examples are quick drop-in starters if you wish to try ScurryPy.

[!TIP] It is recommended to use a .env file for bot tokens. More details about using a .env file here.

Slash Command

# Set TOKEN, APP_ID (bot user ID), and GUILD_ID (for guild command)

# --- Core library imports ---
from scurrypy import Client, EventTypes, InteractionEvent, SlashCommandPart

# --- Setup bot ---
client = Client(token=TOKEN)

async def on_greet(event: InteractionEvent):
    """Respond to /greet"""
    if event.data.name != "greet":
        return

    await client.interaction(event.id, event.token).respond("Hello!")

async def register_commands():
    """Register slash commands on startup (before READY)."""
    await client.guild_command(APP_ID, GUILD_ID).create(
        SlashCommandPart("greet", "Greet the bot!")
    )

client.add_startup_hook(register_commands)
client.add_event_listener(EventTypes.INTERACTION_CREATE, on_greet)

# --- Run the bot ---
client.run()

Prefix Command (Legacy)

# Set TOKEN

# --- Core library imports ---
from scurrypy import Client, Intents, EventTypes, MessageCreateEvent

client = Client(token=TOKEN, intents=Intents.DEFAULT | Intents.MESSAGE_CONTENT)

# --- Setup bot ---
async def on_ping(event: MessageCreateEvent):
    if not event.content:
        return
    
    if not event.content.startswith('!ping'):
        return
    
    await client.channel(event.channel_id).send("Pong!")

client.add_event_listener(EventTypes.MESSAGE_CREATE, on_ping)

# --- Run the bot ---
client.run()

Dependencies

ScurryPy has exactly 3 required dependencies:

  • aiohttp (HTTP client)
  • websockets (Gateway connection)
  • aiofiles (Async file operations)

These dependencies are automatically installed with ScurryPy's pip package.

Learn More

Explore the full documentation for more examples, guides, and API reference.

See the manifesto section for details!

Switching from discord.py? Check out the Migration Guide to see the difference.

Got some questions? Check out the FAQ page for commonly asked questions!

Looking for changes? See the Changelog.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

scurrypy-2.0.0.tar.gz (69.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

scurrypy-2.0.0-py3-none-any.whl (107.7 kB view details)

Uploaded Python 3

File details

Details for the file scurrypy-2.0.0.tar.gz.

File metadata

  • Download URL: scurrypy-2.0.0.tar.gz
  • Upload date:
  • Size: 69.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for scurrypy-2.0.0.tar.gz
Algorithm Hash digest
SHA256 f4309a9b578ab9215036d00274c151caac7a9ea2436d8949d5a1bbd39e0b985f
MD5 9ee7f726450f1da6da33e828bbefa571
BLAKE2b-256 5996e9b2929b93e938f1cbed33a2904e34e04ca3d4430d65fde7b37f5fb2b105

See more details on using hashes here.

File details

Details for the file scurrypy-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: scurrypy-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 107.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.3

File hashes

Hashes for scurrypy-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 755b8de249b1d2dfeb93622d0171ec837d0663c4c965e899dabf85e09bf150f3
MD5 f8af065891a3789d21f6bc65596f48d4
BLAKE2b-256 2ba1a56166c564d9670c1fb39597b58b68197112018b7f3117643eb3a9742494

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page