diff --git a/cogs/moderation.py b/cogs/moderation.py index ab33077..3803b78 100644 --- a/cogs/moderation.py +++ b/cogs/moderation.py @@ -298,8 +298,9 @@ def find_hook(name: str) -> disnake.Webhook | None: else: pass - for webhook in webhooks: - await webhook.delete() + for webhook in await inter.channel.webhooks(): + if webhook.user == self.bot.user: + await webhook.delete() await inter.send( ( @@ -345,6 +346,7 @@ async def senddm( async def _pins(self, inter: disnake.CommandInteraction) -> None: embed = core.TypicalEmbed(inter).set_title('Pinned Messages 📌') pins = await inter.channel.pins() + if pins: for count, pin in enumerate(pins): embed.add_field( @@ -370,8 +372,8 @@ async def _clearpins(self, inter: disnake.CommandInteraction) -> None: if pins: for pin in pins: await pin.unpin() - await inter.send('All pins have been cleared!', ephemeral=True) + await inter.send('All pins have been cleared!', ephemeral=True) else: await inter.send('There are no pins to clear!', ephemeral=True) @@ -441,10 +443,11 @@ async def _banword(self, inter: disnake.CommandInteraction, keywords: str) -> No break else: rule = None + except disnake.NotFound: rule = None - if rule is None: + if not rule: rule = await inter.guild.create_automod_rule( name='IgKnite Banwords', event_type=disnake.AutoModEventType.message_send, diff --git a/core/__init__.py b/core/__init__.py index d305753..843e1d4 100644 --- a/core/__init__.py +++ b/core/__init__.py @@ -17,7 +17,7 @@ from .ui import * # Set version number. -__version_info__ = ('2023', '4', '26') # Year.Month.Day +__version_info__ = ('2023', '4', '29') # Year.Month.Day __version__ = '.'.join(__version_info__)