【发布时间】:2022-01-25 05:06:44
【问题描述】:
我正在为我的机器人制作自定义帮助命令,这是我的代码。
class customhelpcommand(commands.HelpCommand):
def __init__(self):
super().__init__()
async def send_bot_help(self, mapping):
for cog in mapping:
await self.get_destination().send(f"{cog.qualified_name}: {[command.name for command in mapping(cog)]}")
async def send_cog_help(self, cog):
await self.get_destination().send(f"{cog.qualified_name}: {[command.name for command in cog.get_commands()]}")
【问题讨论】:
-
它给出了错误:AttributeError: 'NoneType' object has no attribute 'qualified_name'
-
您首先检查对象(例如,如果 cog 不是 None: ...)那么您应该进一步移动。
标签: python discord.py command bots nonetype