Skip to main content

A simple permission manager for Discord bots.

Project description

ezpermissions

A simple and efficient Discord permission checker that helps you validate user permissions effortlessly! ๐Ÿš€

โœจ Features

  • ๐Ÿ”ง Quick Setup โ€“ Easily integrate permission checks into your bot.
  • ๐ŸŽ› Full Permission Coverage โ€“ Supports all Discord permissions.
  • โœ… True_ & False_ Checks โ€“ Validate if a user has or lacks a permission.
  • ๐Ÿ“ฆ Lightweight & Easy to Use โ€“ No complex setup required.

๐Ÿ“Œ Installation

Prerequisites

Make sure you have Python 3.8+ installed.

python --version

Install ezpermissions

pip install ezpermissions

๐Ÿš€ Usage

To use ezpermissions in your bot, import and apply permission checks:

import discord
from discord.ext import commands
from ezpermissions import permissions

bot = commands.Bot(command_prefix="!")

@bot.command()
@permissions.Administrator.True_  # โœ… Requires Administrator permission
async def admin_only(ctx):
    await ctx.send("โœ… You have Administrator permission!")

@bot.command()
@permissions.ManageMessages.False_  # โŒ Requires NOT having Manage Messages
async def non_moderators(ctx):
    await ctx.send("โœ… You do NOT have Manage Messages permission!")

bot.run("YOUR_BOT_TOKEN")

๐Ÿ”ง Available Permission Checks

ezpermissions provides decorators for all Discord permissions:

Permission True_ (Has) False_ (Lacks)
Administrator @permissions.Administrator.True_ @permissions.Administrator.False_
Manage Guild @permissions.ManageGuild.True_ @permissions.ManageGuild.False_
Manage Roles @permissions.ManageRoles.True_ @permissions.ManageRoles.False_
Ban Members @permissions.BanMembers.True_ @permissions.BanMembers.False_
Kick Members @permissions.KickMembers.True_ @permissions.KickMembers.False_
Send Messages @permissions.SendMessages.True_ @permissions.SendMessages.False_
Read Message History @permissions.ReadMessageHistory.True_ @permissions.ReadMessageHistory.False_
And More! Supports all permissions ๐ŸŽ‰

๐Ÿ“ Project Structure

๐Ÿ“ฆ YourBotProject
โ”œโ”€โ”€ ๐Ÿ“‚ cogs/             # Stores command files (if using cogs)
โ”‚   โ”œโ”€โ”€ __init__.py
โ”‚   โ”œโ”€โ”€ example.py       # Example cog
โ”œโ”€โ”€ ๐Ÿ“œ main.py           # Main bot file
โ”œโ”€โ”€ ๐Ÿ“œ permissions.py    # ezpermissions integration
โ”œโ”€โ”€ ๐Ÿ“œ requirements.txt  # Installed dependencies

๐ŸŽฏ Contributing

We welcome contributions! Feel free to submit a pull request or open an issue.


๐Ÿ“œ License

ezpermissions is open-source and licensed under the MIT License.


๐Ÿ“ฌ Need Help?

Happy coding! ๐ŸŽฉโœจ

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

ezpermissions-1.0.0.tar.gz (4.3 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ezpermissions-1.0.0-py3-none-any.whl (4.6 kB view details)

Uploaded Python 3

File details

Details for the file ezpermissions-1.0.0.tar.gz.

File metadata

  • Download URL: ezpermissions-1.0.0.tar.gz
  • Upload date:
  • Size: 4.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for ezpermissions-1.0.0.tar.gz
Algorithm Hash digest
SHA256 e4a1c36ab4065710113d5f3c9085ccb79b84a23673266e477e1c3a33538756a8
MD5 876c6079a051298d31b2185ab89d2817
BLAKE2b-256 fa27f9c4b96b68f88737c349354c8c8d075f84ab7c8a8efa9187271951418a2c

See more details on using hashes here.

File details

Details for the file ezpermissions-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: ezpermissions-1.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.9

File hashes

Hashes for ezpermissions-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 fe90135b794f8d8ddae61c574b65ca3420863040fc70556e50af5fe205e0cca7
MD5 393a0b421f133bfd5436d01d683ebf64
BLAKE2b-256 24f5d8bcff1821a025046c65dc7266cedaaf28e2634ebbf8a75852d9b410fab2

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