[英]How do I make groups for commands in discord.py and use them in different cogs?
我正在開發一個機器人,我希望將機器人的命令添加到不同的組,但我不知道如何創建組。
有沒有辦法在主 bot 文件中創建組,然后在 cogs 中使用它?
我想你知道如何用這個例子來創建它們。
@client.group(name='system', invoke_without_command=True)
async def system():
pass
@system.command(name='load')
async def hello_subcommand():
print('test')
invoke_without_command=True
的部分將確保命令不會被重復執行。
此代碼中的命令將是 {prefix}system hello
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.