Fixed enable/disable not correcting cache values
This commit is contained in:
parent
1fd5362177
commit
2770d49b07
|
@ -16,13 +16,11 @@ class Admin(commands.Cog):
|
||||||
async def disable(self, ctx, *, command):
|
async def disable(self, ctx, *, command):
|
||||||
"""Disables the use of a command on this server"""
|
"""Disables the use of a command on this server"""
|
||||||
if command == "disable" or command == "enable":
|
if command == "disable" or command == "enable":
|
||||||
await ctx.send("You cannot disable `{}`".format(command))
|
return await ctx.send("You cannot disable `{}`".format(command))
|
||||||
return
|
|
||||||
|
|
||||||
cmd = ctx.bot.get_command(command)
|
cmd = ctx.bot.get_command(command)
|
||||||
if cmd is None:
|
if cmd is None:
|
||||||
await ctx.send("No command called `{}`".format(command))
|
return await ctx.send("No command called `{}`".format(command))
|
||||||
return
|
|
||||||
|
|
||||||
try:
|
try:
|
||||||
await ctx.bot.db.execute(
|
await ctx.bot.db.execute(
|
||||||
|
@ -34,6 +32,11 @@ class Admin(commands.Cog):
|
||||||
await ctx.send(f"{cmd.qualified_name} is already disabled")
|
await ctx.send(f"{cmd.qualified_name} is already disabled")
|
||||||
else:
|
else:
|
||||||
await ctx.send(f"{cmd.qualified_name} is now disabled")
|
await ctx.send(f"{cmd.qualified_name} is now disabled")
|
||||||
|
ctx.bot.cache.add_restriction(
|
||||||
|
ctx.guild,
|
||||||
|
"from",
|
||||||
|
{"source": cmd.qualified_name, "destination": "everyone"}
|
||||||
|
)
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
|
@ -53,6 +56,11 @@ destination='everyone' AND
|
||||||
guild=$2
|
guild=$2
|
||||||
"""
|
"""
|
||||||
await ctx.bot.db.execute(query, cmd.qualified_name, ctx.guild.id)
|
await ctx.bot.db.execute(query, cmd.qualified_name, ctx.guild.id)
|
||||||
|
ctx.bot.cache.remove_restriction(
|
||||||
|
ctx.guild,
|
||||||
|
"from",
|
||||||
|
{"source": cmd.qualified_name, "destination": "everyone"}
|
||||||
|
)
|
||||||
await ctx.send(f"{cmd.qualified_name} is no longer disabled")
|
await ctx.send(f"{cmd.qualified_name} is no longer disabled")
|
||||||
|
|
||||||
@commands.command()
|
@commands.command()
|
||||||
|
|
Loading…
Reference in a new issue