每次我尝试加载齿轮时,它只会给我以下错误
AttributeError: 'Bot' object has no attribute 'all_commands'
这是针对每个齿轮的,我不知道如何修复它。机器人仍在启动,但齿轮未加载。
我的齿轮是这样装的
for file in os.listdir(f"{os.path.realpath(os.path.dirname(__file__))}/cogs"):
if file.endswith(".py"):
extension = file[:-3]
print(f"Loading cog.{extension} . . . . .")
try:
bot.load_extension(f"cogs.{extension}")
print(f"Loaded cog: {extension}")
except Exception as e:
exception = f"{type(e).__name__}: {e}"
print(f"Failed to load cog {extension}\n{exception} bruh moment")
for file in os.listdir(f"{os.path.realpath(os.path.dirname(__file__))}/cogs/commands"):
if file.endswith(".py"):
extension = file[:-3]
print(f"Loading cog.{extension} . . . . .")
try:
bot.load_extension(f"cogs.commands.{extension}")
print(f"Loaded cog: {extension}")
except Exception as e:
exception = f"{type(e).__name__}: {e}"
print(f"Failed to load cog {extension}\n{exception} bruh moment")
for file in os.listdir(f"{os.path.realpath(os.path.dirname(__file__))}/cogs/utils"):
if file.endswith(".py"):
extension = file[:-3]
print(f"Loading cog.{extension} . . . . .")
try:
bot.load_extension(f"cogs.utils.{extension}")
print(f"Loaded cog: {extension}")
except Exception as e:
exception = f"{type(e).__name__}: {e}"
print(f"Failed to load cog {extension}\n{exception} bruh moment")```