Skip to main content

alianator is a tool that helps Pycord and discord.py users easily resolve user-facing aliases for Discord permission flags.

Project description

alianator

alianator is a tool that helps Pycord and discord.py users easily resolve user-facing aliases for Discord permission flags.

Installation

$ pip install alianator

alianator doesn't include either Pycord or discord.py as a dependency; instead, it allows you to use whichever of the two libraries you prefer. alianator does not and will not support other Discord API wrappers, such as Nextcord, Hikari, or disnake.

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 Guild Insights', 'Manage Roles', 'Manage Webhooks', 'Manage Emojis and Stickers']


# Resolving from an integer
perms = 3072
aliases = alianator.resolve(perms)
print(aliases)
# ['Read Messages', 'Send Messages']


# 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.

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

alianator-2.0.0.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

alianator-2.0.0-py3-none-any.whl (4.5 kB view details)

Uploaded Python 3

File details

Details for the file alianator-2.0.0.tar.gz.

File metadata

  • Download URL: alianator-2.0.0.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.2 Darwin/21.4.0

File hashes

Hashes for alianator-2.0.0.tar.gz
Algorithm Hash digest
SHA256 ff3b1281845c9a4d5e358447b361e2224d14b939b4fb5ba2e83b19000513bf2e
MD5 e0b3b522e5f4958d581f01e7896be5c3
BLAKE2b-256 174cf8eb5be12306d1b0b879ef92e7d11f18878bf251aab735acf73444846b59

See more details on using hashes here.

File details

Details for the file alianator-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: alianator-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 4.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.1.13 CPython/3.10.2 Darwin/21.4.0

File hashes

Hashes for alianator-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3a08376eb5bc9680ce43893dd15d9340a59c6f05bfb55e8b9e07c75dc7cd7fb9
MD5 19ae97228603ed91545ec02ea299e4c1
BLAKE2b-256 198bde782c0cbc6838e34bab95e03e59b7ea155b43ccca248dd0f782bc4d7726

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page