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

Editing categories resets command permission overrides #537

Open
eartharoid opened this issue Apr 20, 2024 · 0 comments
Open

Editing categories resets command permission overrides #537

eartharoid opened this issue Apr 20, 2024 · 0 comments

Comments

@eartharoid
Copy link
Member

Updating command permissions removes any custom overrides. Using multiple add() instead of set() calls could be a solution, but could also cause rate-limiting if there are a lot of staff roles.

if (req.user.accessToken) {
Promise.all([
'Create ticket for user',
'claim',
'force-close',
'move',
'priority',
'release',
].map(name =>
client.application.commands.permissions.set({
command: client.application.commands.cache.find(cmd => cmd.name === name),
guild,
permissions: [
{
id: guild.id, // @everyone
permission: false,
type: ApplicationCommandPermissionType.Role,
},
...category.staffRoles.map(id => ({
id,
permission: true,
type: ApplicationCommandPermissionType.Role,
})),
],
token: req.user.accessToken,
}),
))
.then(() => client.log.success('Updated application command permissions in "%s"', guild.name))
.catch(error => client.log.error(error));
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Todo
Development

No branches or pull requests

1 participant