因此,我正在尝试为我的帮助菜单执行以下操作:
import discord
from discord.ext import commands
class Test(commands.Cog):
"""Fun commands"""
def __init__(self, client):
self.client = client
@commands.command()
async def test(self, ctx):
embed = discord.Embed()
for name, cog in self.client.cogs.items():
cmds = cog.get_commands()
cmdString = ''
for command in cmds:
cmdString += "```{}``` ".format(command.name)
print(f'Cog Name: {name}, command: {command.name}')
embed.add_field(name=name, value=cmdString)
await ctx.send(embed=embed)
def setup(client):
client.add_cog(Test(client))
但是每当我尝试执行命令时,我都会得到一个空字段错误,提示该值不应为空。