- android - 多次调用 OnPrimaryClipChangedListener
- android - 无法更新 RecyclerView 中的 TextView 字段
- android.database.CursorIndexOutOfBoundsException : Index 0 requested, 光标大小为 0
- android - 使用 AppCompat 时,我们是否需要明确指定其 UI 组件(Spinner、EditText)颜色
我正在尝试将我的机器人的所有命令转移到齿轮,以使处理和排序更容易。我无法加载我的齿轮。
我尝试了多种不同的加载齿轮的方法,但都不起作用,我尝试过使用不同的 IDE,但也不起作用。
文件夹树
帮助.py
class Help(commands.Cog):
def __init__(self, client):
self.client = client
@commands.command()
async def help(self, ctx):
# Code #
def setup(client):
client.add_cog(Help(client))
机器人.py
if __name__ == '__main__':
for filename in os.listdir('./commands'):
if filename.endswith('.py'):
client.load_extension(f'cogs.{filename[:-3]}')
错误
File "C:\Users\Tyler\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\ext\commands\bot.py", line 617, in load_extension
lib = importlib.import_module(name)
File "C:\Users\Tyler\AppData\Local\Programs\Python\Python37\lib\importlib\__init__.py", line 127, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 953, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
File "<frozen importlib._bootstrap>", line 1006, in _gcd_import
File "<frozen importlib._bootstrap>", line 983, in _find_and_load
File "<frozen importlib._bootstrap>", line 965, in _find_and_load_unlocked
ModuleNotFoundError: No module named 'cogs'
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Tyler\Desktop\Seep\bot.py", line 33, in <module>
client.load_extension(f'cogs.{filename[:-3]}')
File "C:\Users\Tyler\AppData\Local\Programs\Python\Python37\lib\site-packages\discord\ext\commands\bot.py", line 619, in load_extension
raise errors.ExtensionNotFound(name, e) from e
discord.ext.commands.errors.ExtensionNotFound: Extension 'cogs.help' could not be loaded.
最佳答案
client.load_extension(f'cogs.{filename[:-3]}')
根本无法工作,因为您正在使用 cogs.name
加载扩展程序。
应该是:
client.load_extension(f'commands.{filename[:-3]}')
关于python - Discord.ext.commands.errors.ExtensionNotFound : Extension 'cogs.help' could not be loaded,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/56573393/
我有一个问题,我想通过其他程序打开 chrome://extensions/页面,例如 cmd.exe 或其他程序。 我们知道,如果我们用chrome.exe打开一个网站,我们可以在cmd.exe中执
当您编写manifest.json 文件时,您必须为内容脚本指定匹配。 http 和 https 工作正常,但如果我尝试包含 chrome://*/* 或其任何变体,我会得到一个我尝试对我的匹配使用无
我真的很困惑我想制作一个可以扩展用户的Google日历的Chrome扩展程序,我应该在Google API下注册哪种程序? 它是Web App吗?但是我不打算让服务器托管任何东西,因为Chrome扩展
我想在带有chrome-extension://URL的iframe上运行内容脚本。我在我的manifest.json文件中添加了一行代码,该行是从http://code.google.com/chr
目前,我正在使用记事本和 chrome 控制台的组合对我的 google-chrome-extensions 进行编码。我 100% 确信有更好的方法来对这些扩展进行编程。人们使用什么环境? 最佳答案
在编写 manifest.json 文件时,必须指定 matches用于您的内容脚本。 http和 https工作正常,但如果我尝试包含 chrome://*/*或它的任何变体,我收到一个错误,提示我
关闭。这个问题需要details or clarity .它目前不接受答案。 想改进这个问题吗? 通过 editing this post 添加细节并澄清问题. 关闭 7 年前。 Improve
在发布更新后,我正在尝试为我的 Chrome 扩展程序的用户创造流畅的体验。 我在更新应用程序时重新注入(inject)了我的内容脚本,即使用户继续在扩展更新后未刷新的页面上使用我的扩展,我的功能仍然
将扩展程序从 Chrome 移植到 FF 遵循本教程(在 Chrome 中运行良好):http://www.codingscripts.com/check-whether-user-has-a-chr
我正在将 google-chrome 扩展改编成 firefox。 这个扩展相当简单,它只是重新加载当前浏览器窗口并在其中放置一个特定的字符串(它用于在 Odoo 上激活调试状态)。 但是,当我在 m
我正在尝试在普通 HTML 页面(非扩展)中链接到 chrome://extensions。但是单击链接不会执行任何操作: chrome://extensions 右键单击并在新选项卡中打开只会打开
为 String 编写扩展名很容易,但问题是它总是显示为 "MyString".ExtensionMethod() 如果这样写: public static class Extensions{
如题。我正在运行 Joomla 2.5。 “扩展”下拉菜单中唯一可见的项目是: 模块经理 插件管理器 模板管理器 语言经理 编辑:我这样做是为了安装模板,按照此页面上的说明:http://docs.j
基本上我希望文件名以扩展名列表中的扩展名结尾。这是我在 python 中的代码。我已经将一些示例文件名作为列表,如下所示: extensions = ['.mp3','.m4a','.wma'] fi
在 background.html : chrome.tabs.query({active:true, currentWindow:true},function(tabs){ chrome.tab
我有一个可能被用户禁用的 chrome 扩展。在这种情况下,我想创建一个指向 chrome://extensions 菜单的链接。它会是这样的 Chrome extensions 这是不允许的:不允许
我查看了 Google 文档,但不知道如何更改其类型。 这是我加载时遇到的错误。 尝试安装此扩展时出现警告:“browser_action”仅允许用于扩展程序,这是一个旧版打包应用程序。 这是我的ma
我有一个正在构建的 chrome 扩展,它使用 OAuth 访问许多 API。我没有将我的消费者 secret 存储在扩展程序中,而是重定向到获取 token 的服务器,然后重定向回我的扩展程序中的页
我有一个正在构建的 chrome 扩展,它使用 OAuth 访问许多 API。我没有将我的消费者 secret 存储在扩展程序中,而是重定向到获取 token 的服务器,然后重定向回我的扩展程序中的页
这个问题已经有答案了: Why would a developer place a forward slash at the start of each relative path? (4 个回答)
我是一名优秀的程序员,十分优秀!