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

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for scurrypy-0.3.0.tar.gz
Algorithm Hash digest
SHA256 94fdaaa9d34c07a75336e2840613ec83b199d6eb2b352da296ad8e7750f61f2f
MD5 5c926a468859e1f58415f6584ab608b3
BLAKE2b-256 1022cd96d0860b988f4a313ff45561ef4c0f9bea3261544b62f1fb4fc268c4b7

See more details on using hashes here.

File details

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

File metadata

  • Download URL: scurrypy-0.3.0-py3-none-any.whl
  • Upload date:
  • Size: 50.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-0.3.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9c406e2c5b9180b66a41a9dad0b010f4a6bd4b0ace95dd29b91b87c14a80e02a
MD5 588143a2668c86ab05c4ea9823c6c24d
BLAKE2b-256 b5a4a935b8ffc8282a4a6e0836102f9217c11e30733d6ae903c194ed6dee2598

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