Skip to content

Commit

Permalink
better moderation commands again
Browse files Browse the repository at this point in the history
  • Loading branch information
hitblast committed Apr 28, 2023
1 parent 1dd2d0d commit 6148691
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 5 deletions.
11 changes: 7 additions & 4 deletions cogs/moderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
(
Expand Down Expand Up @@ -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(
Expand All @@ -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)

Expand Down Expand Up @@ -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,
Expand Down
2 changes: 1 addition & 1 deletion core/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__)


Expand Down

0 comments on commit 6148691

Please sign in to comment.