如何使 Discord.py 仅开发命令

时间:2021-06-14 19:05:59

标签: discord.py

如何使 Discord.py 仅用于开发命令

def restart_bot():


os.execv(sys.executable, ['python'] + sys.argv)

@Bot.command(name= 'restart')
  async def restart(ctx):
  await ctx.send("Restarting bot...")
  restart_bot()

1 个答案:

答案 0 :(得分:0)

你可以用 @commands.is_owner()

基本上是这样的:

@Bot.command(name = 'restart')
@commands.is_owner()
  async def restart(ctx):
  await ctx.send("Restarting bot...")
  restart_bot()

稍后感谢我 :D