alianator
alianator is a Discord permission name resolver for Pycord.
It takes Discord's API permission flags (e.g. manage_guild) and resolves them to their user-facing aliases (
e.g. Manage Server).
Installation
$ pip install alianator
Usage
alianator can resolve aliases from discord.Permissions objects, integers, strings, tuples, lists of strings, and lists
of tuples.
import alianator
alianator.resolve(arg, mode=mode)
The optional mode flag can be used to specify which permissions should be resolved. If mode is True, only granted
permissions will be resolved; if mode is False, only denied permissions will be resolved; if mode is None, all
permissions will be resolved. If mode is not explicitly specified, it will default to True.
import alianator
import discord
# Resolving from a discord.Permissions object
perms = discord.Permissions.general()
aliases = alianator.resolve(perms)
print(aliases)
# ['Manage Channels', 'Manage Server', 'View Audit Log', 'Read Messages', 'View Server Insights', 'Manage Roles', 'Manage Webhooks', 'Manage Emojis and Stickers']
# Resolving from an integer
perms = 3072
aliases = alianator.resolve(perms)
print(aliases)
# ['View Channel', 'Send Messages and Create Posts']
# Resolving from a string
perms = "send_tts_messages"
aliases = alianator.resolve(perms)
print(aliases)
# ['Send Text-To-Speech Messages']
# Resolving from a tuple
perms = ("moderate_members", True)
aliases = alianator.resolve(perms)
print(aliases)
# ['Timeout Members']
# Resolving from a list of strings
perms = ["manage_guild", "manage_emojis"]
aliases = alianator.resolve(perms)
print(aliases)
# ['Manage Server', 'Manage Emojis and Stickers']
# Resolving from a list of tuples
perms = [("use_slash_commands", True), ("use_voice_activation", True)]
aliases = alianator.resolve(perms)
print(aliases)
# ['Use Application Commands', 'Use Voice Activity']
That's about all there is to it. alianator does one thing and does it well.
License
alianator is released under the MIT License.
Metadata
Release files for alianator 4.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 | |
|---|---|---|---|
| alianator-4.0.2.tar.gz | 5.1 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| alianator-4.0.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.6 kB
Release files / alianator-4.0.2.tar.gz
| Download URL | alianator-4.0.2.tar.gz |
|---|---|
| Size | 5.1 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d4e7a89a22cd57e3d5480a482ee466901b338591d8284812fab02cc82cc71ef7
|
|
BLAKE2b-256 checksum How to use checksums |
e06ff220aa210cc4ae441f943b0ca46fcb088c7239a5d9882419705f9e4ff178
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.1 CPython/3.11.1 Linux/5.15.0-1033-azure
|
Release files / alianator-4.0.2-py3-none-any.whl
| Download URL | alianator-4.0.2-py3-none-any.whl |
|---|---|
| Size | 5.5 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
00101733e0b4837015fe501451cd35f8db5ec06e864d8479fdbd3b82e8a85d3a
|
|
BLAKE2b-256 checksum How to use checksums |
03b33a2809ebcdfeb79e215fe86200e315a5a421726b3db27ee030fbaa31ff40
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.3.1 CPython/3.11.1 Linux/5.15.0-1033-azure
|