logs-spy: ignore messages by staff

This commit is contained in:
Ave Ozkal 2019-03-05 20:33:19 +03:00
parent befa18c4de
commit 921ab28190
No known key found for this signature in database
GPG key ID: 09356ABAA42C842B
2 changed files with 8 additions and 2 deletions

View file

@ -4,6 +4,7 @@ import json
import re import re
import config import config
from helpers.restrictions import get_user_restrictions from helpers.restrictions import get_user_restrictions
from helpers.checks import check_if_staff
class Logs(Cog): class Logs(Cog):
@ -141,6 +142,9 @@ class Logs(Cog):
if message.author.bot: if message.author.bot:
return return
if check_if_staff(message):
return
alert = False alert = False
cleancont = self.clean_re.sub('', message.content).lower() cleancont = self.clean_re.sub('', message.content).lower()
msg = f"🚨 Suspicious message by {message.author.mention} "\ msg = f"🚨 Suspicious message by {message.author.mention} "\

View file

@ -1,5 +1,6 @@
import config import config
def check_if_staff(ctx): def check_if_staff(ctx):
if not ctx.guild: if not ctx.guild:
return False return False
@ -20,10 +21,11 @@ def check_if_staff_or_ot(ctx):
is_staff = any(r.id in config.staff_role_ids for r in ctx.author.roles) is_staff = any(r.id in config.staff_role_ids for r in ctx.author.roles)
return (is_ot or is_staff or is_bot_cmds) return (is_ot or is_staff or is_bot_cmds)
def check_if_collaborator(ctx): def check_if_collaborator(ctx):
return any(r.id in config.staff_role_ids + config.allowed_pin_roles for r in ctx.author.roles) return any(r.id in config.staff_role_ids + config.allowed_pin_roles
for r in ctx.author.roles)
def check_if_pin_channel(ctx): def check_if_pin_channel(ctx):
return ctx.message.channel.id in config.allowed_pin_channels return ctx.message.channel.id in config.allowed_pin_channels