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

Commit 12b4d66

Browse files
authored
fix: Various bugs in channel_delete (#625)
* fix: Re-enable channel id checking when deleting * fix: Use awaitable fetch_channel when querying requested delete channel
1 parent fa3ac25 commit 12b4d66

File tree

1 file changed

+3
-5
lines changed

1 file changed

+3
-5
lines changed

naff/models/discord/guild.py

+3-5
Original file line numberDiff line numberDiff line change
@@ -1159,15 +1159,13 @@ async def delete_channel(
11591159
11601160
"""
11611161
if isinstance(channel, (str, int)):
1162-
channel = await self._client.get_channel(channel)
1162+
channel = await self._client.fetch_channel(channel)
11631163

11641164
if not channel:
11651165
raise ValueError("Unable to find requested channel")
11661166

1167-
# TODO self._channel_ids is not updated properly when new guild channels are created so this check is
1168-
# disabled for now
1169-
# if channel.id not in self._channel_ids:
1170-
# raise ValueError("This guild does not hold the requested channel")
1167+
if channel.id not in self._channel_ids:
1168+
raise ValueError("This guild does not hold the requested channel")
11711169

11721170
await channel.delete(reason)
11731171

0 commit comments

Comments
 (0)