Skip to content

Commit e134deb

Browse files
committed
Look for guild_ids instead of description in register_commands.
1 parent 29a93ac commit e134deb

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

discord/bot.py

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@
4545

4646
from .client import Client
4747
from .shard import AutoShardedClient
48-
from .utils import MISSING, get, async_all
48+
from .utils import MISSING, get, find, async_all
4949
from .commands import (
5050
SlashCommand,
5151
SlashCommandGroup,
@@ -186,14 +186,10 @@ async def register_commands(self) -> None:
186186
cmds = await self.http.bulk_upsert_global_commands(self.user.id, commands)
187187

188188
for i in cmds:
189-
# Discord seems to now return None instead of an empty string...
190-
if i["description"] is None:
191-
i['description'] = ""
192-
193189
cmd = get(
194190
self.pending_application_commands,
195191
name=i["name"],
196-
description=i["description"],
192+
guild_ids=None,
197193
type=i["type"],
198194
)
199195
self.application_commands[i["id"]] = cmd
@@ -229,16 +225,7 @@ async def register_commands(self) -> None:
229225
raise
230226
else:
231227
for i in cmds:
232-
# Discord seems to now return None instead of an empty string...
233-
if i["description"] is None:
234-
i['description'] = ""
235-
236-
cmd = get(
237-
self.pending_application_commands,
238-
name=i["name"],
239-
description=i["description"],
240-
type=i["type"],
241-
)
228+
cmd = find(lambda cmd: cmd.name == i["name"] and cmd.type == i["type"] and int(i["guild_id"]) in cmd.guild_ids, self.pending_application_commands)
242229
self.application_commands[i["id"]] = cmd
243230

244231
# Permissions

0 commit comments

Comments
 (0)