Skip to content
This repository was archived by the owner on Mar 8, 2022. It is now read-only.

Commit 997e205

Browse files
committed
fixed guild_permissions
1 parent 823fdfe commit 997e205

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

discord_ui/slash/types.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,6 +1563,8 @@ async def sync(self, delete_unused=False):
15631563
if api_command:
15641564
# get permissions for the command
15651565
api_permissions = await http.get_command_permissions(api_command["id"], guild)
1566+
# the guild permissions for the current guild
1567+
command_perms = base.guild_permissions.get(int(guild)) or base.guild_permissions.get(str(guild))
15661568
global_command = await self.api.get_global_command(base.name, base.command_type)
15671569
# If no command in that guild or a global one was found
15681570
if api_command is None or global_command is not None:
@@ -1576,8 +1578,8 @@ async def sync(self, delete_unused=False):
15761578
new_command = await http.create_guild_command(base.to_dict(), guild, base.permissions.to_dict())
15771579
elif api_command != base:
15781580
new_command = await http.edit_guild_command(api_command["id"], guild, base.to_dict(), base.permissions.to_dict())
1579-
elif api_permissions != base.permissions:
1580-
await http.update_command_permissions(guild, api_command["id"], base.permissions.to_dict())
1581+
elif api_permissions != command_perms:
1582+
await http.update_command_permissions(guild, api_command["id"], command_perms.to_dict())
15811583
base._id = new_command["id"] if new_command else api_command["id"]
15821584
self._raw_cache[base._id] = base
15831585

0 commit comments

Comments
 (0)