mirror of
https://github.com/brandons209/Red-bot-Cogs.git
synced 2024-05-15 09:54:13 +12:00
fix conflicts between two cogs
This commit is contained in:
parent
e68ebc7875
commit
2fa28c1f7d
|
@ -999,6 +999,22 @@ class Isolate(commands.Cog):
|
|||
await ctx.send("You can't isolate the bot.")
|
||||
return
|
||||
|
||||
# check if user is isolated, fix conflict with isolate cog
|
||||
punish = self.bot.get_cog("Punish")
|
||||
|
||||
if punish:
|
||||
punished = await punish.config.guild(guild).PUNISHED()
|
||||
if str(member.id) in punished:
|
||||
await ctx.send(
|
||||
warning("This person is punished, I will remove it now before isolating to avoid conflicts.")
|
||||
)
|
||||
await ctx.invoke(punish.punish_end, user=member, reason="Conflict with isolate cog.")
|
||||
# double check it actually worked
|
||||
punished = await punish.config.guild(guild).PUNISHED()
|
||||
if str(member.id) in punished:
|
||||
await ctx.send(error("Couldn't remove punish from user, please do it manually."))
|
||||
return
|
||||
|
||||
if duration and duration.lower() in ["forever", "inf", "infinite"]:
|
||||
duration = None
|
||||
else:
|
||||
|
|
|
@ -1069,6 +1069,22 @@ class Punish(commands.Cog):
|
|||
await ctx.send("You can't punish the bot.")
|
||||
return
|
||||
|
||||
# check if user is isolated, fix conflict with isolate cog
|
||||
isolate = self.bot.get_cog("Isolate")
|
||||
|
||||
if isolate:
|
||||
isolated = await isolate.config.guild(guild).ISOLATED()
|
||||
if str(member.id) in isolated:
|
||||
await ctx.send(
|
||||
warning("This person is isolated, I will remove it now before punishing to avoid conflicts.")
|
||||
)
|
||||
await ctx.invoke(isolate.isolate_end, user=member, reason="Conflict with punish cog.")
|
||||
# double check it actually worked
|
||||
isolated = await isolate.config.guild(guild).ISOLATED()
|
||||
if str(member.id) in isolated:
|
||||
await ctx.send(error("Couldn't remove isolation from user, please do it manually."))
|
||||
return
|
||||
|
||||
if duration and duration.lower() in ["forever", "inf", "infinite"]:
|
||||
duration = None
|
||||
else:
|
||||
|
|
Loading…
Reference in a new issue