Skip to content

Commit

Permalink
Merge pull request #226 from hitblast/main
Browse files Browse the repository at this point in the history
🔨 [tuning] Improved async loops syntax
  • Loading branch information
hitblast authored Jun 2, 2023
2 parents 279bfed + 377b340 commit 87924f5
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion cogs/inspection.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ async def _revokeinvites(
deletion_count = 0
await inter.response.defer(ephemeral=True)

for invite in await inter.guild.invites():
async for invite in inter.guild.invites():
if (member and invite.inviter == member) or (not member):
await invite.delete()
deletion_count += 1
Expand Down
8 changes: 4 additions & 4 deletions cogs/moderation.py
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ def find_hook(name: str) -> disnake.Webhook | None:
else:
pass

for webhook in await inter.channel.webhooks():
async for webhook in inter.channel.webhooks():
if webhook.user == self.bot.user:
await webhook.delete()

Expand Down Expand Up @@ -429,7 +429,7 @@ async def _banword(
keywords = keywords.split(',')

try:
for item in await inter.guild.fetch_automod_rules():
async for item in inter.guild.fetch_automod_rules():
if item.name == 'IgKnite Banwords':
rule = item
break
Expand Down Expand Up @@ -475,7 +475,7 @@ async def _clearbannedwords(self, inter: disnake.CommandInteraction) -> None:
await inter.response.defer(ephemeral=True)

try:
for rule in await inter.guild.fetch_automod_rules():
async for rule in inter.guild.fetch_automod_rules():
if rule.name == 'IgKnite Banwords':
await rule.delete(reason=f'Banwords removed by: {inter.author}')

Expand All @@ -498,7 +498,7 @@ async def _showbannedwords(self, inter: disnake.CommandInteraction) -> None:
try:
words = ''

for rule in await inter.guild.fetch_automod_rules():
async for rule in inter.guild.fetch_automod_rules():
if rule.name == 'IgKnite Banwords':
words += (f'{item} \n' for item in rule.trigger_metadata.keyword_filter)
embed = (
Expand Down

0 comments on commit 87924f5

Please sign in to comment.