A package to bridge the gap between Discord's API and Perm-Banana
Project description
Perm-Security
A package to enable the integration between Discord's API and Perm-Banana
Features
- Permission classes for converting Discord's Permissions to Perm-Banana
- Member Adapters to enable Perm-Banana's extended functionality
- The ability to create Tokens
- A TokenStrategy for handling Permissions with Discord's API
How to use it?
from discord import Member
from discord.ext.commands import Cog, Greedy, Context, command
from perm_security.converters import PermissionChannelConverter
from perm_security.MemberAdapter import MemberChannelAdapter
from perm_security.TokenStrategy import BasicTokenStrategy
from perm_security.TokenStrategy.TokenHandlerStrategy import BasicTokenHandlerStrategy
class Security(Cog):
def __init__(self, bot):
self.bot = bot
self.token_strategy = BasicTokenStrategy(BasicTokenHandlerStrategy(bot.scheduler))
@command(name="generate_toke")
async def generate_token(
self,
ctx: Context,
permissions: PermissionChannelConverter,
members: Greedy[Member],
uses: int = 1
duration: float = 60.0
):
author = MemberChannelAdapter(ctx.author, ctx.channel)
await self.token_strategy.generate_token(author, permissions, members, uses, duration)
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
perm_security-0.1.1.tar.gz
(7.5 kB
view hashes)
Built Distribution
Close
Hashes for perm_security-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | a87ddb83d1e60ff150f71440ade85b59270b9a22c2fe8f4107212628a33598c3 |
|
MD5 | ef3960603e1c76b5a04e80dd30b5a4a6 |
|
BLAKE2b-256 | fb1f99f13f58a10982d019ce65e11b9d252d578dfa6ff5326b7550913f6550b9 |