mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 19:28:54 -05:00
[Mod] Fixed some case toggles not working properly
Check is now done at function level
This commit is contained in:
parent
5ba312c45a
commit
361d45e724
14
cogs/mod.py
14
cogs/mod.py
@ -268,8 +268,6 @@ class Mod:
|
|||||||
await self.bot.kick(user)
|
await self.bot.kick(user)
|
||||||
logger.info("{}({}) kicked {}({})".format(
|
logger.info("{}({}) kicked {}({})".format(
|
||||||
author.name, author.id, user.name, user.id))
|
author.name, author.id, user.name, user.id))
|
||||||
if self.settings[server.id].get('kick_cases',
|
|
||||||
default_settings['kick_cases']):
|
|
||||||
await self.new_case(server,
|
await self.new_case(server,
|
||||||
action="KICK",
|
action="KICK",
|
||||||
mod=author,
|
mod=author,
|
||||||
@ -317,8 +315,6 @@ class Mod:
|
|||||||
await self.bot.ban(user, days)
|
await self.bot.ban(user, days)
|
||||||
logger.info("{}({}) banned {}({}), deleting {} days worth of messages".format(
|
logger.info("{}({}) banned {}({}), deleting {} days worth of messages".format(
|
||||||
author.name, author.id, user.name, user.id, str(days)))
|
author.name, author.id, user.name, user.id, str(days)))
|
||||||
if self.settings[server.id].get('ban_cases',
|
|
||||||
default_settings['ban_cases']):
|
|
||||||
await self.new_case(server,
|
await self.new_case(server,
|
||||||
action="BAN",
|
action="BAN",
|
||||||
mod=author,
|
mod=author,
|
||||||
@ -365,8 +361,6 @@ class Mod:
|
|||||||
logger.info("{}({}) softbanned {}({}), deleting 1 day worth "
|
logger.info("{}({}) softbanned {}({}), deleting 1 day worth "
|
||||||
"of messages".format(author.name, author.id, user.name,
|
"of messages".format(author.name, author.id, user.name,
|
||||||
user.id))
|
user.id))
|
||||||
if self.settings[server.id].get('softban_cases',
|
|
||||||
default_settings['softban_cases']):
|
|
||||||
await self.new_case(server,
|
await self.new_case(server,
|
||||||
action="SOFTBAN",
|
action="SOFTBAN",
|
||||||
mod=author,
|
mod=author,
|
||||||
@ -432,8 +426,6 @@ class Mod:
|
|||||||
"lower than myself in the role hierarchy.")
|
"lower than myself in the role hierarchy.")
|
||||||
else:
|
else:
|
||||||
dataIO.save_json("data/mod/perms_cache.json", self._perms_cache)
|
dataIO.save_json("data/mod/perms_cache.json", self._perms_cache)
|
||||||
if self.settings[server.id].get('cmute_cases',
|
|
||||||
default_settings['cmute_cases']):
|
|
||||||
await self.new_case(server,
|
await self.new_case(server,
|
||||||
action="CMUTE",
|
action="CMUTE",
|
||||||
channel=channel,
|
channel=channel,
|
||||||
@ -472,8 +464,6 @@ class Mod:
|
|||||||
return
|
return
|
||||||
self._perms_cache[user.id] = register
|
self._perms_cache[user.id] = register
|
||||||
dataIO.save_json("data/mod/perms_cache.json", self._perms_cache)
|
dataIO.save_json("data/mod/perms_cache.json", self._perms_cache)
|
||||||
if self.settings[server.id].get('smute_cases',
|
|
||||||
default_settings['smute_cases']):
|
|
||||||
await self.new_case(server,
|
await self.new_case(server,
|
||||||
action="SMUTE",
|
action="SMUTE",
|
||||||
mod=author,
|
mod=author,
|
||||||
@ -1296,6 +1286,10 @@ class Mod:
|
|||||||
return False
|
return False
|
||||||
|
|
||||||
async def new_case(self, server, *, action, mod=None, user, reason=None, until=None, channel=None):
|
async def new_case(self, server, *, action, mod=None, user, reason=None, until=None, channel=None):
|
||||||
|
action_type = action.lower() + "_cases"
|
||||||
|
if not self.settings[server.id].get(action_type, default_settings[action_type]):
|
||||||
|
return
|
||||||
|
|
||||||
mod_channel = server.get_channel(self.settings[server.id]["mod-log"])
|
mod_channel = server.get_channel(self.settings[server.id]["mod-log"])
|
||||||
if mod_channel is None:
|
if mod_channel is None:
|
||||||
return
|
return
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user