mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[Mod] Added clear commands for whitelist/blacklist
This commit is contained in:
parent
eba80519fd
commit
5f57ac29ee
26
cogs/mod.py
26
cogs/mod.py
@ -335,21 +335,28 @@ class Mod:
|
|||||||
"""Adds user to bot's blacklist"""
|
"""Adds user to bot's blacklist"""
|
||||||
if user.id not in self.blacklist_list:
|
if user.id not in self.blacklist_list:
|
||||||
self.blacklist_list.append(user.id)
|
self.blacklist_list.append(user.id)
|
||||||
fileIO("data/mod/blacklist.json", "save", self.blacklist_list)
|
dataIO.save_json("data/mod/blacklist.json", self.blacklist_list)
|
||||||
await self.bot.say("User has been added to blacklist.")
|
await self.bot.say("User has been added to blacklist.")
|
||||||
else:
|
else:
|
||||||
await self.bot.say("User is already blacklisted.")
|
await self.bot.say("User is already blacklisted.")
|
||||||
|
|
||||||
@blacklist.command(name="remove")
|
@blacklist.command(name="remove")
|
||||||
async def _blacklist_remove(self, user: discord.Member):
|
async def _blacklist_remove(self, user: discord.Member):
|
||||||
"""Removes user to bot's blacklist"""
|
"""Removes user from bot's blacklist"""
|
||||||
if user.id in self.blacklist_list:
|
if user.id in self.blacklist_list:
|
||||||
self.blacklist_list.remove(user.id)
|
self.blacklist_list.remove(user.id)
|
||||||
fileIO("data/mod/blacklist.json", "save", self.blacklist_list)
|
dataIO.save_json("data/mod/blacklist.json", self.blacklist_list)
|
||||||
await self.bot.say("User has been removed from blacklist.")
|
await self.bot.say("User has been removed from blacklist.")
|
||||||
else:
|
else:
|
||||||
await self.bot.say("User is not in blacklist.")
|
await self.bot.say("User is not in blacklist.")
|
||||||
|
|
||||||
|
@blacklist.command(name="clear")
|
||||||
|
async def _blacklist_clear(self):
|
||||||
|
"""Clears the blacklist"""
|
||||||
|
self.blacklist_list = []
|
||||||
|
dataIO.save_json("data/mod/blacklist.json", self.blacklist_list)
|
||||||
|
await self.bot.say("Blacklist is now empty.")
|
||||||
|
|
||||||
@commands.group(pass_context=True)
|
@commands.group(pass_context=True)
|
||||||
@checks.is_owner()
|
@checks.is_owner()
|
||||||
async def whitelist(self, ctx):
|
async def whitelist(self, ctx):
|
||||||
@ -366,21 +373,28 @@ class Mod:
|
|||||||
else:
|
else:
|
||||||
msg = ""
|
msg = ""
|
||||||
self.whitelist_list.append(user.id)
|
self.whitelist_list.append(user.id)
|
||||||
fileIO("data/mod/whitelist.json", "save", self.whitelist_list)
|
dataIO.save_json("data/mod/whitelist.json", self.whitelist_list)
|
||||||
await self.bot.say("User has been added to whitelist." + msg)
|
await self.bot.say("User has been added to whitelist." + msg)
|
||||||
else:
|
else:
|
||||||
await self.bot.say("User is already whitelisted.")
|
await self.bot.say("User is already whitelisted.")
|
||||||
|
|
||||||
@whitelist.command(name="remove")
|
@whitelist.command(name="remove")
|
||||||
async def _whitelist_remove(self, user: discord.Member):
|
async def _whitelist_remove(self, user: discord.Member):
|
||||||
"""Removes user to bot's whitelist"""
|
"""Removes user from bot's whitelist"""
|
||||||
if user.id in self.whitelist_list:
|
if user.id in self.whitelist_list:
|
||||||
self.whitelist_list.remove(user.id)
|
self.whitelist_list.remove(user.id)
|
||||||
fileIO("data/mod/whitelist.json", "save", self.whitelist_list)
|
dataIO.save_json("data/mod/whitelist.json", self.whitelist_list)
|
||||||
await self.bot.say("User has been removed from whitelist.")
|
await self.bot.say("User has been removed from whitelist.")
|
||||||
else:
|
else:
|
||||||
await self.bot.say("User is not in whitelist.")
|
await self.bot.say("User is not in whitelist.")
|
||||||
|
|
||||||
|
@whitelist.command(name="clear")
|
||||||
|
async def _whitelist_clear(self):
|
||||||
|
"""Clears the whitelist"""
|
||||||
|
self.whitelist_list = []
|
||||||
|
dataIO.save_json("data/mod/whitelist.json", self.whitelist_list)
|
||||||
|
await self.bot.say("Whitelist is now empty.")
|
||||||
|
|
||||||
@commands.group(pass_context=True, no_pm=True)
|
@commands.group(pass_context=True, no_pm=True)
|
||||||
@checks.admin_or_permissions(manage_channels=True)
|
@checks.admin_or_permissions(manage_channels=True)
|
||||||
async def ignore(self, ctx):
|
async def ignore(self, ctx):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user