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

Slash Commands Permissions don't work sometimes #1155

Closed
3 tasks done
AwesomeSam9523 opened this issue Mar 10, 2022 · 6 comments
Closed
3 tasks done

Slash Commands Permissions don't work sometimes #1155

AwesomeSam9523 opened this issue Mar 10, 2022 · 6 comments
Labels
unconfirmed bug A bug report that needs triaging

Comments

@AwesomeSam9523
Copy link

Summary

The permissions aren't registered correctly.

Reproduction Steps

So I have 2 bots. 1 main bot and other beta bot.
I tested out @permissions.has_role on a slash commnad.

Here is the code: (Same on both bots)

@slash_command(default_permission=False)
@permissions.has_role(868890524755582995)
async def bgpanel(
    self,
    ctx: ApplicationContext,
    type_: discord.Option(str, description='Type of panel- pbg or cbg.', name='type', choices=['Personal BG', 'Clan BG']),
    name: discord.Option(str, description='Name of the background.')
):
    '''
    This is a developer/staff command. Top secret!!!
    '''
    ...

The permission works on beta bot but not on main bot.
This is to note that I also have debug_guilds=[...] for my beta bot.

This is also to mention that its been 2-3 hours since the main bot was started. No restarts in between.

Minimal Reproducible Code

No response

Expected Results

The command permissions should work on both equally.

Actual Results

image
Works only on beta bot.

Intents

intents = discord.Intents(guild_reactions=True, guild_messages=True, guilds=True, dm_messages=True, members=True)

System Information

- Python v3.8.10-final
- py-cord v2.0.0-beta
    - py-cord pkg_resources: v2.0.0b5
- aiohttp v3.8.1
- system info: Linux 5.11.0-1029-gcp #33~20.04.3-Ubuntu SMP Tue Jan 18 12:03:29 UTC 2022

Checklist

  • I have searched the open issues for duplicates.
  • I have shown the entire traceback, if possible.
  • I have removed my token from display, if visible.

Additional Context

No response

@AwesomeSam9523 AwesomeSam9523 added the unconfirmed bug A bug report that needs triaging label Mar 10, 2022
@AwesomeSam9523
Copy link
Author

Update: 6 hours and still not accessible.

@tkuye
Copy link

tkuye commented Mar 15, 2022

I'm experiencing a similar issue as well as once I made the commands global, the permissions were loading incorrectly.

@DaTurr3t
Copy link
Contributor

Same. Something that seemed odd to me is that there is a section in Bot.sync_commands, which seems to handle global commands but is not triggered unless there are some guild-specific ones. I was unable to replicate this tho, Im gonna try to modify the routine anyways

@TurnrDev
Copy link
Contributor

TurnrDev commented Mar 22, 2022

I have a similar issue, I have used @permissions.is_owner() but the command is available to all

    @_cog_control.command(name="list", default_permission=False)
    @permissions.is_owner()
    async def list_cogs(self, ctx: ApplicationContext) -> None:
        """List all cogs."""
        ...

Code permalink

@DaTurr3t
Copy link
Contributor

Update: looks like the current permission model only supports guild-specific permissions. Code to register global permissions is not run when not registering to a specific guild. We'll se what permissions v2 will give us.

@BobDotCom
Copy link
Member

All effort on the permissions front will be put towards v2, as v1 will be deprecated soon. No plans to fix this as it's soon to be obsolete.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
unconfirmed bug A bug report that needs triaging
Projects
None yet
Development

No branches or pull requests

5 participants