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.2.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.2-py3-none-any.whl (50.6 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: scurrypy-0.2.2.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.2.tar.gz
Algorithm Hash digest
SHA256 97f8c6f9ea35f213493a03f35ef4999c6762bd664cda7cb805e013a3abe99acc
MD5 51da49747f0fcad7021c41927bc0e25d
BLAKE2b-256 ca1172caff744eb8e740ca4ce367c3c6b81387d19b48644691441737d6ab034b

See more details on using hashes here.

File details

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

File metadata

  • Download URL: scurrypy-0.2.2-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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0ef7aa5cd62e2144e5d378666c4b6c42b55153e463f25e5b27092e8e2336b358
MD5 e41dabd0d763788c4675b08daa832a00
BLAKE2b-256 4585529ae862eb4088184e8ad08acb658cab98018831c0783fdc4e5a1a3c4ad2

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