Skip to content

Commit

Permalink
[PersonalChannels] betterify blacklist
Browse files Browse the repository at this point in the history
  • Loading branch information
japandotorg committed Oct 9, 2023
1 parent de221f0 commit a73e0d9
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions personalchannels/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,10 @@ async def _create(
await ctx.send(f"{user.display_name} already has a personal channel.")
self._create.reset_cooldown(ctx)
return
if name.casefold() in await self.config.guild(ctx.guild).blacklist():
if any(
item.casefold() in name.casefold()
for item in await self.config.guild(ctx.guild).blacklist()
):
await ctx.send("This channel name is blacklisted.")
self._create.reset_cooldown(ctx)
return
Expand Down Expand Up @@ -464,7 +467,10 @@ async def _name(self, ctx: commands.Context, *, name: commands.Range[str, 1, 32]
channel = await self.config.member(ctx.author).channel()
channel = ctx.guild.get_channel(channel)
await self.check_text_channels(ctx, channel)
if name.casefold() in await self.config.guild(ctx.guild).blacklist():
if any(
item.casefold() in name.casefold()
for item in await self.config.guild(ctx.guild).blacklist()
):
await ctx.send("This channel name is blacklisted.")
self._name.reset_cooldown(ctx)
return
Expand Down Expand Up @@ -492,7 +498,10 @@ async def _topic(self, ctx: commands.Context, *, topic: str):
channel = await self.config.member(ctx.author).channel()
channel = ctx.guild.get_channel(channel)
await self.check_text_channels(ctx, channel)
if await self.config.guild(ctx.guild).blacklist() in topic.casefold():
if any(
item.casefold() in topic.casefold()
for item in await self.config.guild(ctx.guild).blacklist()
):
await ctx.send("This channel topic is blacklisted.")
self._topic.reset_cooldown(ctx)
return
Expand Down

0 comments on commit a73e0d9

Please sign in to comment.