Skip to main content

Discord API Wrapper in Python

Project description

Welcome to ScurryPy

PyPI version

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=1234567890 # 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(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=1234567890, # replace with your bot's user ID
    intents=discord.set_intents(message_content=True),
    prefix='!' # your custom prefix
)

@bot.prefix_command
async def ping(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


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.2.1.tar.gz (36.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.2.1-py3-none-any.whl (50.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scurrypy-0.2.1.tar.gz
  • Upload date:
  • Size: 36.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.2.1.tar.gz
Algorithm Hash digest
SHA256 8fd9a1b320d6a18019b71194e19ec190be1ac78169b3a1110acd04bb653c572f
MD5 0a10fe76b1cabe086b92ba55d298823c
BLAKE2b-256 18c05036b3cfe5f8c22b08ba5b4990f8226e596dd04fe0bf989a2351dc59ff57

See more details on using hashes here.

File details

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

File metadata

  • Download URL: scurrypy-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 50.6 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.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 371a12142ecec68eb49c49060dd6dff0b5bc4e95dda5165b9f39932be1aa318e
MD5 b3d585cf4931a497b6ccb2ac363f9ec0
BLAKE2b-256 d5b643838f72a545c63a3c3bcb4fab03a91c3c8922895f836b16d43ec8c12e62

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