[Core] Target any user with blacklist / whitelist commands (#1068)

This commit is contained in:
Twentysix
2017-11-06 23:51:33 +01:00
committed by GitHub
parent 4f61daf51a
commit 58d669d07e
2 changed files with 52 additions and 5 deletions

View File

@@ -1,6 +1,7 @@
import discord
from discord.ext import commands
from cogs.utils import checks
from cogs.utils.converters import GlobalUser
from __main__ import set_cog
from .utils.dataIO import dataIO
from .utils.chat_formatting import pagify, box
@@ -535,7 +536,7 @@ class Owner:
await self.bot.send_cmd_help(ctx)
@blacklist.command(name="add")
async def _blacklist_add(self, user: discord.Member):
async def _blacklist_add(self, user: GlobalUser):
"""Adds user to Red's global blacklist"""
if user.id not in self.global_ignores["blacklist"]:
self.global_ignores["blacklist"].append(user.id)
@@ -545,7 +546,7 @@ class Owner:
await self.bot.say("User is already blacklisted.")
@blacklist.command(name="remove")
async def _blacklist_remove(self, user: discord.Member):
async def _blacklist_remove(self, user: GlobalUser):
"""Removes user from Red's global blacklist"""
if user.id in self.global_ignores["blacklist"]:
self.global_ignores["blacklist"].remove(user.id)
@@ -583,7 +584,7 @@ class Owner:
await self.bot.send_cmd_help(ctx)
@whitelist.command(name="add")
async def _whitelist_add(self, user: discord.Member):
async def _whitelist_add(self, user: GlobalUser):
"""Adds user to Red's global whitelist"""
if user.id not in self.global_ignores["whitelist"]:
if not self.global_ignores["whitelist"]:
@@ -597,7 +598,7 @@ class Owner:
await self.bot.say("User is already whitelisted.")
@whitelist.command(name="remove")
async def _whitelist_remove(self, user: discord.Member):
async def _whitelist_remove(self, user: GlobalUser):
"""Removes user from Red's global whitelist"""
if user.id in self.global_ignores["whitelist"]:
self.global_ignores["whitelist"].remove(user.id)
@@ -927,7 +928,7 @@ class Owner:
for user_id in _list:
user = discord.utils.get(self.bot.get_all_members(), id=user_id)
if user:
users.append(str(user))
users.append("{} ({})".format(user, user.id))
if users:
not_found = total - len(users)