Skip to main content

discord-ext-check

discord-ext-check is a module which implements various decorator functions, to be used on discord command functions for your DiscordPY bot

Installation:

Installation is done using pip:

Usage:

Starting off, import discord.ext.check and then you can use its various decorator functions.

Examples:

from discord.ext import check

#.. Creating your Discord Bot ...

"""Checking if the author is the Server Owner"""
@bot.command()
@check.is_guild_owner()
async def foo(ctx):
    await ctx.send(f"{ctx.author.mention} is the Server Owner!")

"""Checking if 3 arguments were passed into the function"""
@bot.command()
@check.has_args(3)
async def bar(ctx, x, y):
    await ctx.send(f"The result is {x + y}")

"""Error Handling"""
@bar.error
async def bar_error(ctx, error):
    if isinstance(error, check.NotEnoughArgs):
        await ctx.send("You have to Enter 3 Arguments (ctx, x, and y) for the command to work")
    else:
        raise error

"""Checking if the author's id is in the list of Authorized Members"""
authorized_members = [394320584089010179, 446670262440820746, 449864700306522112]

@bot.command()
@check.has_user_id_in(authorized_members)
async def baz(ctx):
    await ctx.send("You are an Authorized Member.")

"""Error Handling"""
@baz.error
async def baz_error(ctx, error):
    if isinstance(error, check.MissingID):
        await ctx.send("You are not Authorized.")
    else:
        raise error

bot.run(token)

Notes:

  • A Documentation for this module will be coming soon..

Metadata

Release files for discord-ext-check 0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for discord-ext-check 0.1
File Size Uploaded
discord-ext-check-0.1.tar.gz 3.4 kB Details

Release files / discord-ext-check-0.1.tar.gz

Download URL discord-ext-check-0.1.tar.gz
Size 3.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1fb4f2d9e7b504a812d09d7e301b8cd9b6de57e4c8371bed2481cb001bb39e5f
BLAKE2b-256 checksum
How to use checksums
416891b5045c5f6f9c43e547b5d2b02905d448ecb4d14201eeb9c13c70c38593
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.3.0 pkginfo/1.7.0 requests/2.25.1 setuptools/49.2.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.9.2

Release history Release notifications | RSS feed

This release

0.1 This release

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page