Browse Source

added checks so that slowmode doesnt trigger for mods. I thought this was in before but must have been removed.

tags/v1.6.1
Roxie Gibson 6 years ago
parent
commit
567002f855
2 changed files with 14 additions and 3 deletions
  1. +1
    -1
      Roxbot/checks.py
  2. +13
    -2
      Roxbot/cogs/admin.py

+ 1
- 1
Roxbot/checks.py View File

@@ -17,7 +17,7 @@ def _is_admin_or_mod(ctx):
if ctx.message.author.id == load_config.owner:
return True
else:
admin_roles = gs.get(ctx.guild).perm_roles["admin"]
admin_roles = gs.get(ctx.guild).perm_roles["admin"]
mod_roles = gs.get(ctx.guild).perm_roles["mod"]
for role in ctx.author.roles:
if role.id in mod_roles or role.id in admin_roles:

+ 13
- 2
Roxbot/cogs/admin.py View File

@@ -4,10 +4,21 @@ import datetime
from discord.ext import commands
from discord.ext.commands import bot

from Roxbot import checks
from Roxbot import checks, load_config
from Roxbot.settings import guild_settings as gs


def _is_admin_or_mod(message):
if message.author.id == load_config.owner:
return True
else:
admin_roles = gs.get(message.channel.guild).perm_roles["admin"]
mod_roles = gs.get(message.channel.guild).perm_roles["mod"]
for role in message.author.roles:
if role.id in mod_roles or role.id in admin_roles:
return True
return False


class Admin():
"""
@@ -25,7 +36,7 @@ class Admin():
author = message.author

if not author == self.bot.user:
if self.slow_mode and channel.id in self.slow_mode_channels:
if (self.slow_mode and channel.id in self.slow_mode_channels) and not _is_admin_or_mod(message):
if author.id not in self.users[channel.id]:
# If user hasn't sent a message in this channel after slow mode was turned on
self.users[channel.id][author.id] = message.created_at

Loading…
Cancel
Save