Python 如何为公会停用comand
我希望这样,如果服务器未被验证,那么执行的命令将不会被执行 我试过使用Python 如何为公会停用comand,python,discord,discord.py,Python,Discord,Discord.py,我希望这样,如果服务器未被验证,那么执行的命令将不会被执行 我试过使用command.update(),但似乎没有真正起作用 请帮忙 @commands.Cog.listener() async def on_command(self, ctx): with open(env["JSON_DIR"] + "servers.json", "r") as f: s = json.load(f) if not
command.update()
,但似乎没有真正起作用
请帮忙
@commands.Cog.listener()
async def on_command(self, ctx):
with open(env["JSON_DIR"] + "servers.json", "r") as f:
s = json.load(f)
if not ctx.message.content == f"{ctx.prefix}verify":
if str(ctx.guild.id) in s:
command = self.bot.get_command(ctx.message.content.split(f"{ctx.prefix}")[1])
print(command)
command.update(enabled=False)
await ctx.send(embed=discord.Embed(title="No estais verificados", description="Para poder verificar el server poner `$verify`", color=0x00fbff))
else:
command = self.bot.get_command(ctx.message.content.split(f"{ctx.prefix}")[1])
command.update(enabled=True)