Dataclass-driven Discord API Wrapper in Python
Project description
ScurryPy
A tiny, explicit Discord API wrapper built to give you primitives, not policies.
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.
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
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file scurrypy-0.7.tar.gz.
File metadata
- Download URL: scurrypy-0.7.tar.gz
- Upload date:
- Size: 36.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
76a99b04980b1fed7d293171b525af7b28eabde613204dcf6d42fac922810ec3
|
|
| MD5 |
5c54a1af65abcc30d12b255333f94de4
|
|
| BLAKE2b-256 |
287cbcb444d9dea7142098f9cd10d480b348b3181ef8e6554e4e3642e2771439
|
File details
Details for the file scurrypy-0.7-py3-none-any.whl.
File metadata
- Download URL: scurrypy-0.7-py3-none-any.whl
- Upload date:
- Size: 51.4 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
46c84b62b6d64708362880c7253dde72c6728518d860b681215ecbd239e042a6
|
|
| MD5 |
bf8bfd61f9ade350448a880b077f99e6
|
|
| BLAKE2b-256 |
1ce4b281104d0b5c503bc971d24255f96e478fc7943fb90de6ded46a1ceb6490
|