-
-
Save Rapptz/2a7a299aa075427357e9b8a970747c2c to your computer and use it in GitHub Desktop.
Slash Command DSL
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from discord import slash | |
class Permissions(slash.SlashCommand): | |
"""manage permissions of a member""" | |
pass | |
class PermissionsGet(slash.SlashCommand, parent=Permissions, name='get'): | |
"""get permissions of a member""" | |
member: discord.Member = slash.argument(description='the member to get permissions of') | |
async def run(self, interaction: discord.Interaction): | |
... | |
class PermissionsSet(slash.SlashCommand, parent=Permissions, name='set'): | |
"""set permissions of a member""" | |
member: discord.Member = slash.argument(description='the member to edit permissions for') | |
permissions: int = slash.argument(description='the permissions number to give') | |
async def run(self, interaction: discord.Interaction): | |
... | |
class PermissionsCheck(slash.SlashCommand, parent=Permissions, name='check'): | |
"""check permissions of a member""" | |
member: discord.Member = slash.argument(description='the member to check permissions of') | |
channel: discord.TextChannel = slash.argument(description='the channel to check permissions in') | |
async def run(self, interaction: discord.Interaction): | |
... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@slash.command() | |
async def permissions(interaction): | |
"""manage permissions of a member""" | |
... | |
@permissions.command(name='get') | |
async def permissions_get( | |
interaction: discord.Interaction, | |
member: discord.Member = slash.argument(description='the member to get permissions of'), | |
): | |
"""get permissions of a member""" | |
pass | |
@permissions.command(name='set') | |
async def permissions_set( | |
interaction: discord.Interaction, | |
member: discord.Member = slash.argument(description='the member to edit permissions for'), | |
permissions: int = slash.argument(description='the permissions number to give'), | |
): | |
"""set permissions of a member""" | |
pass | |
@permissions.command(name='check') | |
async def permissions_check( | |
interaction: discord.Interaction, | |
member: discord.Member = slash.argument(description='the member to check permissions of'), | |
channel: discord.TextChannel = slash.argument(description='the channel to check permissions in'), | |
): | |
"""check permissions of a member""" | |
pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment