Skip to content

Commit 952b5ec

Browse files
authored
Merge pull request #349 from TheGamerX20/cmd_none_fix
Fix cmd returning None in register_commands due to API change/bug
2 parents 1e77d6e + e134deb commit 952b5ec

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

discord/bot.py

Lines changed: 3 additions & 8 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,
@@ -189,7 +189,7 @@ async def register_commands(self) -> None:
189189
cmd = get(
190190
self.pending_application_commands,
191191
name=i["name"],
192-
description=i["description"],
192+
guild_ids=None,
193193
type=i["type"],
194194
)
195195
self.application_commands[i["id"]] = cmd
@@ -225,12 +225,7 @@ async def register_commands(self) -> None:
225225
raise
226226
else:
227227
for i in cmds:
228-
cmd = get(
229-
self.pending_application_commands,
230-
name=i["name"],
231-
description=i["description"],
232-
type=i["type"],
233-
)
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)
234229
self.application_commands[i["id"]] = cmd
235230

236231
# Permissions

0 commit comments

Comments
 (0)