Skip to main content

Dataclass-driven Discord API Wrapper in Python

Project description

ScurryPy

PyPI version

A dataclass-driven Discord API wrapper in Python!

While this wrapper is mainly used for various squirrel-related shenanigans, it can also be used for more generic bot purposes.

Features

  • Easy to extend
  • Command, and event handling
  • Unix shell-style wildcards for component routing
  • Declarative style using decorators
  • Supports both legacy and new features
  • Respects Discord’s rate limits
  • No __future__ hacks to avoid circular import
  • Capable of sharding

Getting Started

Note: This section also appears in the documentation, but here are complete examples ready to use with your bot credentials.

Installation

To install the ScurryPy package, run:

pip install scurrypy

Minimal Slash Command

The following demonstrates building and responding to a slash command.

Note: Adjust dotenv_path if your .env file is not in the same directory as this script.

import scurrypy

client = scurrypy.Client(
    token='your-token',
    application_id=APPLICATION_ID  # your bot’s application ID
)

@client.command(
    scurrypy.SlashCommand('example', 'Demonstrate the minimal slash command!'), 
    GUILD_ID  # must be a guild ID your bot is in
)
async def example(bot: scurrypy.Client, event: scurrypy.InteractionEvent):
    await event.interaction.respond(f'Hello, {event.interaction.member.user.username}!')

client.run()

Minimal Prefix Command (Legacy)

The following demonstrates building and responding to a message prefix command.

import scurrypy

client = scurrypy.Client(
    token='your-token',
    application_id=APPLICATION_ID,  # your bot’s application ID
    intents=scurrypy.set_intents(message_content=True),
    prefix='!'  # your custom prefix
)

@client.prefix_command("ping")
async def on_ping(bot: scurrypy.Client, event: scurrypy.MessageCreateEvent):
    await event.message.send("Pong!")

client.run()

Like What You See?

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

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-0.6.2.tar.gz (37.0 kB view details)

Uploaded Source

Built Distribution

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

scurrypy-0.6.2-py3-none-any.whl (50.0 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for scurrypy-0.6.2.tar.gz
Algorithm Hash digest
SHA256 4b3c9153dbdf3b5385b16a6e67d581fe8923d02e1b57b79da9c06a7231f7f93b
MD5 78be84048a2f274b6ba955537eaef88f
BLAKE2b-256 82216c39b892ca4c1f17ca0dafbe6d9661cd2c18a9156c5069c47e97b6811697

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for scurrypy-0.6.2-py3-none-any.whl
Algorithm Hash digest
SHA256 fb792377632f7632f06f167d3499a50f82fbbba6428bdc8eb1e1a498ccd1dec6
MD5 c46c8c546f2697c56f9239f8cffd6af8
BLAKE2b-256 dad928877cecc42e32d3276b2139c553b90856f4ea47d1ffcfde37e7a142dd2b

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