Skip to main content

A simple set of tools to write easier code using discord-py-interactions

Project description

discord-py-interactions

Write easier code using discord-interactions with interactions-styled.

About | Installation | Examples | Discord | PyPI | Documentation

About

What?

discord-interactions-styled is a set of already coded functions, decorators an more for the known discord-py-interactions library.

Why?

Well, discord-py-interactions is already pretty easy right? but, when you're working on a large-size bot it becomes repetitive to write always the same code to get results, it's redundant, that's when interactions-styled comes to the scene with a full set of functions to get results so much faster.

How?

Just look at this example, we're denying permissions for @everyone and allowing them for two role ids 456 and 789:

# base library
@slash.slash(..., permissions={
    123: [
        create_permission(123, SlashCommandPermissionType.ROLE, False),
        create_permission(456, SlashCommandPermissionType.ROLE, True)
        create_permission(789, SlashCommandPermissionType.ROLE, True)
    ]
})

# With discord-interactions-styled
@slash.slash(...)
@only_allow_roles(123, [456, 789])

That's some clean & pretty code right there huh

Installation

You can install this lib using pip, just type the following line below:

pip install -U discord-interactions-styled

Examples

Creating options for a slash command

from discord_slash.utils.manage_commands import create_option

# discord-py-interactions
@slash.slash(..., options=[
    create_option("option1", "my description", 3, True),
    create_option("option2", "another description", 4, True)
    create_option("option3", "and another", 3, False)
])

# discord-interactions-styled
from discord_styled.slash import option

@option("option1", "my description")
@option("option2", "another description", 4)
@option("option3", "and another", required=False)
@slash.slash(...)

Denying permissions for @everyone in a slash command

# discord-py-interactions
from discord_slash.utils.manage_commands import create_permission

@slash.slash(..., permissions={
    123: [
        create_permission(123, SlashCommandPermissionType.ROLE, False)
    ]
})

# discord-interactions-styled
from discord_styled.permissions import deny_all

@slash.slash(...)
@deny_all()

Documentation

These are just a few examples, we recommend you to go and visit the official documentation


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

discord-interactions-styled-0.5.1.tar.gz (8.0 kB view details)

Uploaded Source

File details

Details for the file discord-interactions-styled-0.5.1.tar.gz.

File metadata

  • Download URL: discord-interactions-styled-0.5.1.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.4.2 importlib_metadata/4.6.4 pkginfo/1.7.1 requests/2.23.0 requests-toolbelt/0.9.1 tqdm/4.62.1 CPython/3.9.5

File hashes

Hashes for discord-interactions-styled-0.5.1.tar.gz
Algorithm Hash digest
SHA256 3da0bec5e55379e8bb19931f98481f1e5453b000d9d6f33931b4b5552994866b
MD5 0c1c51bb4906d94c8872076b48c79ad8
BLAKE2b-256 49ee28fe8380c6751cf0c3819274f3af54c1806d5b59a7498202a1290aa8ad88

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