Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(permissions): add Permissions.create_expressions and Permissions.create_events #1094

Open
wants to merge 10 commits into
base: master
Choose a base branch
from

Conversation

spifory
Copy link
Collaborator

@spifory spifory commented Jul 18, 2023

Summary

Tested with

from typing import Optional

from nextcord import Intents, Interaction, Member, Permissions
from nextcord.ext.commands import Bot

bot = Bot(
    intents=Intents(guilds=True, message_content=True, messages=True),
    default_guild_ids=[...],
)

@bot.slash_command(default_member_permissions=Permissions(manage_events=True))
async def perms(inter: Interaction, user: Optional[Member]):
    assert inter.user is not None
    assert isinstance(inter.user, Member)
    perms = inter.channel.permissions_for(user or inter.user)
    return await inter.send(f"ev: {perms.create_events}\nexp: {perms.create_expressions}")

bot.run(...)

image
image

This is a Code Change

  • I have tested my changes.
  • I have updated the documentation to reflect the changes.
  • I have run task pyright and fixed the relevant issues.

Copy link
Member

@ooliver1 ooliver1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any chance on adding this to the if TYPE_CHECKING: like the other permissions?

@spifory
Copy link
Collaborator Author

spifory commented Jul 18, 2023

Any chance on adding this to the if TYPE_CHECKING: like the other permissions?

Must have missed that, but will do

@spifory spifory added t: enhancement Type: enhancement - new feature or request p: medium Priority: medium - should be worked on in the near future s: awaiting review Status: the issue or PR is awaiting reviews t: api coverage Type: api coverage - this adds code to cover the discord API s: waiting for discord status: the issue requires changes to the documentation or behaviour before it can be completed. labels Jul 18, 2023
@spifory spifory requested a review from ooliver1 July 18, 2023 14:38
@EmmmaTech EmmmaTech removed the t: enhancement Type: enhancement - new feature or request label Jul 19, 2023
@spifory spifory marked this pull request as ready for review December 16, 2023 19:26
@spifory
Copy link
Collaborator Author

spifory commented Dec 16, 2023

Re-opened since the superseded (discord/discord-api-docs#6120) PR (discord/discord-api-docs#6578) has been merged into the API docs

@spifory spifory changed the title feat(permissions): add Permissions.create_expressions feat(permissions): add Permissions.create_expressions and Permissions.create_events Dec 16, 2023
@spifory spifory removed the s: waiting for discord status: the issue requires changes to the documentation or behaviour before it can be completed. label Dec 16, 2023
Copy link
Member

@ooliver1 ooliver1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The Permissions class methods would need to be updated to include these, but I believe those are outdated for other permissions currently.

nextcord/permissions.py Outdated Show resolved Hide resolved
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p: medium Priority: medium - should be worked on in the near future s: awaiting review Status: the issue or PR is awaiting reviews t: api coverage Type: api coverage - this adds code to cover the discord API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants