Install
pip install dpy-check
Docs
PENDING... Until then, here is some implementation code:
import dpycheck as chk
from discord.ext import commands
bot = commands.Bot(...)
# if the error handler has been attached to an object,
# it can be acquired through `ErrorHandler.get(object)`
error_handler = chk.ErrorHandler(..., attach_to=bot)
@bot.command()
@chk.ctx.Check.all(
chk.user_has_role(...),
chk.Any(
chk.membership("d") >= 5,
chk.user_has_channel_perms(...)
)
)
async def cmd(...): ...
cmd.error(error_handler.error)
bot.run(...)
When using extensions, you must use .placeholder in combination with resolve_placeholders if you want to use the error handler:
import dpycheck as chk
from discord.ext import commands
class mycog(commands.Cog):
def __init__(self, bot: commands.Bot) -> None:
self.bot = bot
# get the attached ErrorHandler and run `resolve_placeholders`
chk.ErrorHandler.get(bot).resolve_placeholders(self)
# we use a placeholder and resolve in `__init__`
# to attach the error handler. Make sure the
# placeholder is at the very top (or more specifically,
# make sure it happens *after* the command is created)
@chk.ErrorHandler.placeholder
@chk.ctx.Check.all(
10 >= chk.membership("m") >= 5,
chk.in_channel(...),
chk.Not(chk.user_has_role(...))
)
@commands.command()
async def cmd(...): ...
async def setup(...):...
Metadata
Release files for dpy-check 0.0.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| dpy-check-0.0.2.tar.gz | 11.8 kB | Without provenance | Details for dpy-check-0.0.2.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| dpy_check-0.0.2-py3-none-any.whl | Python 3 | none | any | Details for dpy_check-0.0.2-py3-none-any.whl |
Total release size: 29.5 kB
Release files / dpy-check-0.0.2.tar.gz
| Download URL | dpy-check-0.0.2.tar.gz |
|---|---|
| Size | 11.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
12a0a50a0ebe3649cd5eac6f72b7979f67d71084a26ac176b2e70b46119e3853
|
|
BLAKE2b-256 checksum How to use checksums |
8c47752522048f577d668294c5ef981b6d9f5b0c8d8fff1df0d7ceba6f43455e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.1
|
Release files / dpy_check-0.0.2-py3-none-any.whl
| Download URL | dpy_check-0.0.2-py3-none-any.whl |
|---|---|
| Size | 17.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
f44e8645f1ff01047ec26106c92d7f4ae39d94e6191b8d1c4b3c797c7ce00ab9
|
|
BLAKE2b-256 checksum How to use checksums |
3f56474d71fab564b62df491f85a0539393e7591fa9d0f37277c333defcbc354
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/4.0.1 CPython/3.10.1
|
Security for dpy-check 0.0.2
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.