-
Notifications
You must be signed in to change notification settings - Fork 188
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
application_checks error #1163
Comments
Same happens with
import nextcord
from nextcord.ext import commands
client = commands.Bot("test!", intents=nextcord.Intents.all())
@client.command()
@commands.check_any(commands.has_guild_permissions(manage_guild=True))
async def ping(ctx: commands.Context):
return await ctx.send("Pong!")
client.run("TOKEN")
|
This is not the same @A1Asriel, that is |
I understand, but even if it's in another module, it still produces the same error and is triggered by the same conditions. I can open another issue, if needed. |
Has anyone found a workaround to this issue? |
@Lenochxd you can copy the original check function and change the return statement to def has_permissions(**perms):
invalid = set(perms) - set(nextcord.Permissions.VALID_FLAGS)
if invalid:
raise TypeError(f"Invalid permission(s): {', '.join(invalid)}")
def predicate(interaction: nextcord.Interaction) -> bool:
ch = interaction.channel
try:
permissions = ch.permissions_for(interaction.user)
except AttributeError:
raise application_checks.ApplicationNoPrivateMessage()
missing = [perm for perm, value in perms.items() if getattr(permissions, perm) != value]
if not missing:
return True
raise application_checks.ApplicationMissingPermissions(missing)
return application_checks.check(predicate) Then use it as usual: @application_checks.check_any(
has_permissions(administrator=True)
) |
Summary
application_checks.check_any() raises a TypeError
Reproduction Steps
Wrap a slash command in
application_checks.check_any()
decorator withhas_permissions()
orhas_guild_permissions()
checks.Minimal Reproducible Code
Expected Results
The slash command registers without any errors.
Actual Results
Intents
nextcord.Intents.all()
System Information
Checklist
Additional Context
The problem seems to occur only with these checks:
has_permissions
has_guild_permissions
bot_has_permissions
bot_has_guild_permissions
This decorator works fine:
The text was updated successfully, but these errors were encountered: