Python discord.py:我是否可以让bot所有者能够在任何服务器上使用任何命令,而不管我是否拥有所需的perm?

Python discord.py:我是否可以让bot所有者能够在任何服务器上使用任何命令,而不管我是否拥有所需的perm?,python,discord,discord.py,Python,Discord,Discord.py,我想让有manage_messages perms的人可以使用这个命令,加上我,机器人的所有者,即使我没有manage_messages perms,也可以使用这个命令。以下是我目前掌握的代码: @commands.command() @commands.has_permissions(manage_messages = True) async def spam(self, ctx, msg, delay: int): global on on = True wh

我想让有manage_messages perms的人可以使用这个命令,加上我,机器人的所有者,即使我没有manage_messages perms,也可以使用这个命令。以下是我目前掌握的代码:

@commands.command()
  @commands.has_permissions(manage_messages = True)
  async def spam(self, ctx, msg, delay: int):
    global on
    on = True
    while on:
      await ctx.send(msg)
      await asyncio.sleep(int(delay))
  @spam.error
  async def spam_error(self, ctx, error):
    if isinstance(error, commands.MissingRequiredArgument):
        await ctx.send(f"Missing argument(s). Proper usage: `{prefix}spam <message to spam> <delay in seconds>`")
    if isinstance(error, commands.MissingPermissions):
        await ctx.send("Missing permission(s): Manage_Messages")
    if isinstance(error, commands.BadArgument):
      await ctx.send("The delay must be an integer")
  
@commands.command()
@commands.has_权限(manage_messages=True)
异步def垃圾邮件(self、ctx、msg、delay:int):
全球
on=真
在职期间:
等待ctx发送(msg)
等待异步睡眠(int(延迟))
@垃圾邮件.错误
异步定义垃圾邮件_错误(self、ctx、error):
如果isinstance(错误,commands.MissingRequiredArgument):
等待ctx.send(f“缺少参数。正确用法:`{prefix}spam`”)
如果isinstance(错误,commands.MissingPermissions):
等待ctx.send(“缺少权限:管理消息”)
如果isinstance(错误,commands.BadArgument):
等待ctx.send(“延迟必须是整数”)
是的,这是可能的


@commands.check_any(commands.is_owner(),commands.has_权限(manage_messages=True)
@commands.command()
#在这里指挥
参考资料:
  • 如果任何一个检查返回true,则返回true
  • 如果作者是bot的所有者,则返回true
注: 不确定这一点但是,如果您使用bot绕过mod命令,自己使用它,可能会对ToS不利