Browse Source

Removing obsolete command that is convered by the library.

tags/v1.4.0
roxie 6 years ago
parent
commit
71428a7fd0
2 changed files with 7 additions and 11 deletions
  1. +5
    -9
      checks.py
  2. +2
    -2
      cogs/admin.py

+ 5
- 9
checks.py View File

@@ -1,18 +1,17 @@
from discord.ext import commands
import load_config
from config.server_config import ServerConfig
import discord

def is_bot_owner():
return commands.check(lambda ctx: ctx.message.author.id == load_config.owner)

def is_owner_or_admin():
def predicate(ctx):
if ctx.message.author.id == load_config.owner:
if ctx.author.id == load_config.owner:
return True
else:
for role in ctx.message.author.roles:
if role.id in ServerConfig().load_config()[ctx.message.server.id]["perm_roles"]["admin"]:
for role in ctx.author.roles:
if role.id in ServerConfig().load_config()[ctx.server.id]["perm_roles"]["admin"]:
return True
return False
return commands.check(predicate)
@@ -22,8 +21,8 @@ def is_admin_or_mod():
if ctx.message.author.id == load_config.owner:
return True
else:
admin_roles = ServerConfig().load_config()[ctx.message.server.id]["perm_roles"]["admin"]
mod_roles = ServerConfig().load_config()[ctx.message.server.id]["perm_roles"]["mod"]
admin_roles = ServerConfig().load_config()[ctx.server.id]["perm_roles"]["admin"]
mod_roles = ServerConfig().load_config()[ctx.server.id]["perm_roles"]["mod"]
for role in ctx.message.author.roles:
if role.id in mod_roles or role.id in admin_roles:
return True
@@ -44,6 +43,3 @@ def is_nfsw_enabled():

def isnt_anal():
return commands.check(lambda ctx: ServerConfig().load_config()[ctx.message.server.id]["is_anal"]["y/n"] and nsfw_predicate(ctx) or not ServerConfig().load_config()[ctx.message.server.id]["is_anal"]["y/n"])

def not_pm():
return commands.check(lambda ctx: ctx.message.channel.type != discord.ChannelType.private)

+ 2
- 2
cogs/admin.py View File

@@ -3,7 +3,7 @@ import time
import checks
import discord
from config.server_config import ServerConfig
from discord.ext.commands import bot, group
from discord.ext.commands import bot, group, guild_only


class Admin():
@@ -38,7 +38,7 @@ class Admin():
else:
pass

@checks.not_pm()
@guild_only()
@checks.is_admin_or_mod()
@bot.command(pass_context=True)
async def slowmode(self, ctx, time):

Loading…
Cancel
Save