Discord API Wrapper in Python
Project description
Welcome to ScurryPy
Yet another 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
- Command and event handling
- Declarative style using decorators
- Supports both legacy and new features
- Respects Discord's rate limits
Something things to consider...
- This is an early version — feedback, ideas, and contributions are welcome! With that said, there will be bumps in the road so expect bugs and other flaws!
- Some features are not yet supported, such as sharding and automod, while others, like voice, will never be supported. While this library can handle many of your basic needs, common features such as sharding or auto-mod actions are not yet implemented. See the license for details on usage.
Getting Started
While this tab shows up in the docs, here are some complete examples where all you need to do is pop in your bot's 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 discord, os
from dotenv import load_dotenv
load_dotenv(dotenv_path='./path/to/env') # omit argument if your env file is on the same level
bot = discord.Client(
token=os.getenv("DISCORD_TOKEN"),
application_id=APPLICATION_ID # replace with your bot's user ID
)
@bot.command(
command=discord.SlashCommand(name='example', description='Demonstrate the minimal slash command!'),
guild_id=GUILD_ID # must be a guild ID your bot is in!
)
async def example(bot: discord.Client, event: discord.InteractionEvent):
await event.interaction.respond(f'Hello, {event.interaction.member.user.username}!')
bot.run()
Minimal Prefix Command (Legacy)
The following demonstrates building and responding to a message prefix command.
import discord, os
from dotenv import load_dotenv
load_dotenv(dotenv_path='./path/to/env') # omit argument if your env file is on the same level
bot = discord.Client(
token=os.getenv("DISCORD_TOKEN"),
application_id=APPLICATION_ID, # replace with your bot's user ID
intents=discord.set_intents(message_content=True),
prefix='!' # your custom prefix
)
@bot.prefix_command
async def ping(bot: discord.Client, event: discord.MessageCreateEvent): # the function name is the name of the command!
await event.message.send(f"Pong!")
bot.run()
Like what you see?
See the docs for more!
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.3.2.tar.gz.
File metadata
- Download URL: scurrypy-0.3.2.tar.gz
- Upload date:
- Size: 36.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.3
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
20fc7843e7773fd2ed18a386e35334d3f8c76b3dedc3104569175830459143e0
|
|
| MD5 |
357189342c8c3657c166d4e3c48ae5fe
|
|
| BLAKE2b-256 |
cc0e2e9df759fcfdfc55fd8725b2413b57049ac14106bbd95fbe954675230135
|
File details
Details for the file scurrypy-0.3.2-py3-none-any.whl.
File metadata
- Download URL: scurrypy-0.3.2-py3-none-any.whl
- Upload date:
- Size: 51.6 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 |
9e6dd96abf8fbbf6993e14486ba4b336b78b0a1f60a8a1eb49bd3cfda1b5a72e
|
|
| MD5 |
bfa84e2d80b3e5d04f6d57477e1075dd
|
|
| BLAKE2b-256 |
26cb39749d28cfb61feea5665fc0e12fde61b4e887120ed1f642426951b9203c
|