Improved LinkCop
Now checks if the message was from a blocked channel first
This commit is contained in:
@@ -54,10 +54,10 @@ class LinkCop(commands.Cog):
|
||||
if self.bot.user.id not in self.whitelisted_ID:
|
||||
self.whitelisted_ID.append(self.bot.user.id)
|
||||
|
||||
if ctx.author.id not in self.whitelisted_ID:
|
||||
try:
|
||||
if not any(item.id in self.whitelisted_groups for item in ctx.author.roles):
|
||||
if ctx.channel.id in self.blocked_channels:
|
||||
if ctx.channel.id in self.blocked_channels:
|
||||
if ctx.author.id not in self.whitelisted_ID:
|
||||
try:
|
||||
if not any(item.id in self.whitelisted_groups for item in ctx.author.roles):
|
||||
if check_message(ctx.content):
|
||||
print('Msg with links detected in a blocked channel')
|
||||
|
||||
@@ -67,9 +67,9 @@ class LinkCop(commands.Cog):
|
||||
await self.send_message(response_text)
|
||||
# Delete the original message
|
||||
await ctx.delete()
|
||||
except AttributeError as err:
|
||||
print(f"Link Cop Error: '{err}'")
|
||||
print(f"Bot or other non-user that has not been whitelisted sent a message")
|
||||
except AttributeError as err:
|
||||
print(f"Link Cop Error: '{err}'")
|
||||
print(f"Bot or other non-user that has not been whitelisted sent a message")
|
||||
|
||||
async def send_message(self, message):
|
||||
send_channel = self.bot.get_channel(id=self.reply_channel_id)
|
||||
|
||||
Reference in New Issue
Block a user