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

Commit 34a2c46

Browse files
author
kuso-senpai
committed
fixed 403 no permission slashcommands
1 parent 1e008a5 commit 34a2c46

File tree

4 files changed

+23
-1
lines changed

4 files changed

+23
-1
lines changed

README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,24 @@ You can find more (and better) examples [here](https://github.com/discord-py-ui/
172172

173173
# Changelog
174174

175+
- <details>
176+
<summary>4.1.4</summary>
177+
178+
## **Fixed**
179+
- slashcommands in forbidden guilds
180+
> when trying to get slash commands in a guild with no `appication.commands` permission, it won't throw an exepction anymore
181+
182+
</details>
183+
184+
- <details>
185+
<summary>4.1.2</summary>
186+
187+
## **Fixed**
188+
- Subcommands editing
189+
> subcommand checks were wrong and this would result in errors like `In options.0.options.2: Option name 'name' is already used in these options`
190+
191+
</details>
192+
175193
- <details>
176194
<summary>4.1.1</summary>
177195

discord_ui/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,4 +44,4 @@
4444

4545

4646
__title__ = "discord-ui"
47-
__version__ = "4.1.1"
47+
__version__ = "4.1.4"

discord_ui/client.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -506,6 +506,7 @@ async def add_guild_command(self, base, guild_id):
506506
await delete_global_command(self._discord, global_command["id"])
507507
await create_guild_command(base.to_dict(), self._discord, target_guild, base.permissions.to_dict())
508508
elif api_command != base:
509+
# for some reason, if you sync commands with cogs, it will duplicate the options of a subgroup command
509510
# print("api_command", api_command, "\n", "base", base.to_dict())
510511
await edit_guild_command(api_command["id"], self._discord, target_guild, base.to_dict(), base.permissions.to_dict())
511512
elif api_permissions != base.permissions:

discord_ui/slash/http.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,4 +130,7 @@ async def get_guild_commands(client, guild_id):
130130
if ex.status == 429:
131131
await handle_rate_limit(await ex.response.json())
132132
return await get_guild_commands(client, guild_id)
133+
if ex.status == 403:
134+
logging.warning("got forbidden in " + str(guild_id))
135+
return []
133136
raise ex

0 commit comments

Comments
 (0)