【发布时间】:2019-11-16 21:25:42
【问题描述】:
我有一个带有 cog 的公共机器人,但我刚刚测试过,如果我加载/卸载一个 cog,它会在它所在的每个服务器上加载/卸载该 cog,这对于公共机器人来说当然是可怕的
我将展示我的加载和卸载命令:
@client.command()
async def load(ctx, extension):
client.load_extension(f"cogs.{extension}")
await ctx.send(f"Successfully loaded the {extension} module :thumbsup: ")
@load.error
async def load_error(ctx, error):
await ctx.send(f"The following error occured:```\n{error}\n```")
是加载命令,并且:
@client.command()
async def unload(ctx, extension):
client.unload_extension(f"cogs.{extension}")
await ctx.send(f"Successfully unloaded the {extension} module :thumbsup: ")
@unload.error
async def unload_error(ctx, error):
await ctx.send(f"The following error occured:```\n{error}\n```")
是卸载命令
编辑:我不介意尝试我正在尝试之外的其他东西
【问题讨论】:
-
你必须对你的 cog 进行编程,让它们知道从哪里调用命令并在某些行会中忽略它们。
-
我可能不知道该怎么做,而且我无法为它加入的每个服务器设置它,因为任何人都可以邀请机器人
标签: python python-3.x discord.py-rewrite