找不到扩展。齿轮 discord.py
Extension not found. Cogs discord.py
这是我的代码。
for filename in os.listdir('lib\commands'):
if filename.endswith('.py'):
client.load_extension(f'cogs.{filename[:-3]}')
我的错误:
Exception has occurred: ExtensionNotFound
Extension 'cogs.ping_clear' could not be loaded.
File "C:\Users\sakch\Desktop\Bot\main.py", line 15, in <module>
client.load_extension(f'cogs.{filename[:-3]}')
This is my folder where the file is present.
您在 load_extension
中输入了错误的路径。您应该传递与 os.listdir
中相同的路径
for filename in os.listdir('lib\commands'):
if filename.endswith('.py'):
client.load_extension(f'lib.commands.{filename[:-3]}')
这是我的代码。
for filename in os.listdir('lib\commands'):
if filename.endswith('.py'):
client.load_extension(f'cogs.{filename[:-3]}')
我的错误:
Exception has occurred: ExtensionNotFound
Extension 'cogs.ping_clear' could not be loaded.
File "C:\Users\sakch\Desktop\Bot\main.py", line 15, in <module>
client.load_extension(f'cogs.{filename[:-3]}')
This is my folder where the file is present.
您在 load_extension
中输入了错误的路径。您应该传递与 os.listdir
for filename in os.listdir('lib\commands'):
if filename.endswith('.py'):
client.load_extension(f'lib.commands.{filename[:-3]}')