Comments (35)
如果你不使用docker或者k8s部署,你可以按照readme填写.env.prod
后通过env ENVIRONMENT=prod python bot.py
启动
from qq-github-bot.
好 待我尝试后反馈
from qq-github-bot.
目前我的环境是 Windows11 + LLOneBot
刚刚尝试在项目根目录创建 .env.prod
文件并执行对应命令报错,烦请有时间提供详细教程供我和其他用户参考,已提前赞助致谢🥰
from qq-github-bot.
请提供你的日志和报错截图
from qq-github-bot.
from qq-github-bot.
powershell 里你需要使用 $env:ENVIRONEMNT = 'prod'
设置环境变量
from qq-github-bot.
from qq-github-bot.
麻烦提供一下依赖列表?🤦♂️
from qq-github-bot.
还是说我新建一个nonebot直接覆盖进去?
from qq-github-bot.
安装环境:poetry install --without dev
from qq-github-bot.
目前的情况是:
本次讨论结束后我会根据我的部署流程提供pr来完善Readme
from qq-github-bot.
你没有设置环境变量,请先切换到prod环境并根据readme填写完成.env.prod
文件后启动。
或者你可以把以下内容复制并填写完整:
LOG_LEVEL=INFO
SUPERUSERS=[]
ONEBOT_API_ROOTS={}
QQ_IS_SANDBOX=false
QQ_BOTS='
[
{
"id": "xxx",
"token": "xxx",
"secret": "xxx",
"intent": {
"guild_messages": true,
"at_messages": false
}
}
]
'
POSTGRES_HOST=
POSTGRES_PORT=
POSTGRES_USER=bot
POSTGRES_PASSWORD=bot_postgres
POSTGRES_DB=bot
REDIS_HOST=
REDIS_PORT=
REDIS_PASSWORD=bot_redis
FILEHOST_URL_BASE=http://example.com
# Github App 配置
GITHUB_THEME=dark
GITHUB_APPS='
[
{
"app_id": "",
"private_key": [
"-----BEGIN RSA PRIVATE KEY-----",
"~~ YOUR PRIVATE KEY HERE ~~",
"-----END RSA PRIVATE KEY-----"
],
"client_id": "",
"client_secret": "",
"webhook_secret": ""
},
{
"client_id": "",
"client_secret": ""
}
]
from qq-github-bot.
你现在的启动流程和开发流程一致,已经不属于「部署」这个范围了
from qq-github-bot.
报错,好像是类型不匹配
Traceback (most recent call last):
File "C:\Users\Administrator\Downloads\新建文件夹\QQ-GitHub-Bot-master\QQ-GitHub-Bot-master\bot.py", line 23, in <module>
driver.register_adapter(GitHubAdapter)
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\nonebot\internal\driver\abstract.py", line 79, in register_adapter
self._adapters[name] = adapter(self, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\nonebot\adapters\github\adapter.py", line 40, in __init__
self.github_config = get_plugin_config(Config)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\nonebot\plugin\__init__.py", line 120, in get_plugin_config
return type_validate_python(config, model_dump(get_driver().config))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\nonebot\compat.py", line 215, in type_validate_python
return TypeAdapter(type_).validate_python(data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\pydantic\type_adapter.py", line 258, in validate_python
return self.validator.validate_python(__object, strict=strict, from_attributes=from_attributes, context=context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for Config
github_apps
Input should be a valid list [type=list_type, input_value='\n[\n {\n "app_id": ...t_secret": ""\n }\n]\n', input_type=str]
For further information visit https://errors.pydantic.dev/2.6/v/list_type
from qq-github-bot.
没有头绪、卡住了🤦♂️
我在 Nonebot
用户交流群内(浅风),如果需要我提供配置文件可以私聊我我发给您
from qq-github-bot.
你的github apps配置项填写错误,请确保为json格式
from qq-github-bot.
from qq-github-bot.
关键是我也没改过格式啊🤔
from qq-github-bot.
你需要给key每一行都要引号和逗号,除了最后一行不用逗号
from qq-github-bot.
懂了
from qq-github-bot.
依旧报错 持续傻眼中....
Traceback (most recent call last):
File "C:\Users\Administrator\Downloads\新建文件夹\QQ-GitHub-Bot-master\QQ-GitHub-Bot-master\bot.py", line 24, in <module>
driver.register_adapter(ONEBOT_V11_Adapter)
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\nonebot\internal\driver\abstract.py", line 79, in register_adapter
self._adapters[name] = adapter(self, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\nonebot\adapters\onebot\v11\adapter.py", line 71, in __init__
self.onebot_config: Config = get_plugin_config(Config)
^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\nonebot\plugin\__init__.py", line 120, in get_plugin_config
return type_validate_python(config, model_dump(get_driver().config))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\nonebot\compat.py", line 215, in type_validate_python
return TypeAdapter(type_).validate_python(data)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\pydantic\type_adapter.py", line 258, in validate_python
return self.validator.validate_python(__object, strict=strict, from_attributes=from_attributes, context=context)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pydantic_core._pydantic_core.ValidationError: 1 validation error for Config
onebot_api_roots
Input should be a valid dictionary [type=dict_type, input_value=None, input_type=NoneType]
For further information visit https://errors.pydantic.dev/2.6/v/dict_type
from qq-github-bot.
请参考 #76 (comment) 中的配置内容,你遗漏了配置项。
from qq-github-bot.
好我检查一下
from qq-github-bot.
对照后基本上能启动了,还有一个报错,是关于 RSA 密钥的,我已经明确比对过密钥填写完整并且按照约定的格式
04-30 21:22:48 [ERROR] uvicorn | Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\jwt\algorithms.py", line 350, in prepare_key
RSAPrivateKey, load_pem_private_key(key_bytes, password=None)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\cryptography\hazmat\backends\openssl\backend.py", line 494, in _handle_key_loading_error
raise ValueError(
ValueError: ('Could not deserialize key data. The data may be in an incorrect format, it may be encrypted with an unsupported algorithm, or it may be an unsupported key type (e.g. EC curves with explicit parameters).', [<OpenSSLError(code=503841036, lib=60, reason=524556, reason_text=unsupported)>])
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\githubkit\core.py", line 303, in _arequest
return await client.request(
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\httpx\_client.py", line 1574, in request
return await self.send(request, auth=auth, follow_redirects=follow_redirects)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\httpx\_client.py", line 1661, in send
response = await self._send_handling_auth(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\httpx\_client.py", line 1686, in _send_handling_auth
request = await auth_flow.__anext__()
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\githubkit\auth\app.py", line 209, in async_auth_flow
request.headers["Authorization"] = f"Bearer {await self.aget_jwt()}"
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\githubkit\auth\app.py", line 84, in aget_jwt
token = self._create_jwt()
^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\githubkit\auth\app.py", line 70, in _create_jwt
return jwt.encode(
^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\jwt\api_jwt.py", line 73, in encode
return api_jws.encode(
^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\jwt\api_jws.py", line 160, in encode
key = alg_obj.prepare_key(key)
^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\jwt\algorithms.py", line 353, in prepare_key
return cast(RSAPublicKey, load_pem_public_key(key_bytes))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
ValueError: Unable to load PEM file. See https://cryptography.io/en/latest/faq/#why-can-t-i-import-my-pem-file for more details. InvalidData(InvalidByte(0, 126))
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\starlette\routing.py", line 734, in lifespan
async with self.lifespan_context(app) as maybe_state:
File "C:\Users\Administrator\AppData\Local\Programs\Python\Python312\Lib\contextlib.py", line 210, in __aenter__
return await anext(self.gen)
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\nonebot\drivers\fastapi.py", line 153, in _lifespan_manager
await self._lifespan.startup()
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\nonebot\internal\driver\_lifespan.py", line 41, in startup
await self._run_lifespan_func(self._startup_funcs)
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\nonebot\internal\driver\_lifespan.py", line 35, in _run_lifespan_func
await cast(ASYNC_LIFESPAN_FUNC, func)()
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\nonebot\adapters\github\adapter.py", line 68, in _startup
await asyncio.gather(
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\nonebot\adapters\github\adapter.py", line 75, in _startup_app
await bot._get_self_info()
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\nonebot\adapters\github\bot.py", line 228, in _get_self_info
res = await self._github.rest.apps.async_get_authenticated()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\githubkit\versions\v2022_11_28\rest\apps.py", line 109, in async_get_authenticated
return await self._github.arequest(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\githubkit\core.py", line 459, in arequest
raw_resp = await self._arequest(
^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Administrator\AppData\Local\pypoetry\Cache\virtualenvs\qq-github-bot-ptmfP7eY-py3.12\Lib\site-packages\githubkit\core.py", line 317, in _arequest
raise RequestError(repr(e)) from e
githubkit.exception.RequestError: ValueError('Unable to load PEM file. See https://cryptography.io/en/latest/faq/#why-can-t-i-import-my-pem-file for more details. InvalidData(InvalidByte(0, 126))')
from qq-github-bot.
请检查你填写的是否是private key
from qq-github-bot.
是呀 Github APP 生成下载的
from qq-github-bot.
那也没有其他办法,还是检查一下你的内容是否一致,报错就是你的key内容不正确无法解析
from qq-github-bot.
那我重新生成一个再试试
from qq-github-bot.
还是相同的情况
from qq-github-bot.
你下载的key文件应该是一模一样的BEGIN RSA PRIVATE KEY
开头的文件,把这个文件一模一样复制到json里头尾加上引号和逗号,不应该有这个问题才对。
from qq-github-bot.
按照您上面提到的格式 两次的Key都无法被识别
from qq-github-bot.
那也有可能是你的openssl不支持这个格式的key,Windows的openssl我也不熟悉
from qq-github-bot.
没有头绪 临门一脚的东西 唉...
from qq-github-bot.
建议你可以在wsl里尝试,如果没问题的话应该就是系统原因
from qq-github-bot.
好我这就去试试
from qq-github-bot.
Related Issues (20)
- 希望服务器状态能添加更多触发条件 HOT 2
- Bug: qq_group in group_subscirption should not be unique HOT 1
- Bug: `mentioned` event should not show
- Bug: user permission check failed when subscribe
- webhook 的 handle 中 username 的获取可能有问题
- Feature: webhook event debounce
- Feature: use oauth app to get public info
- Bug: Error rendering pull request status
- Feature: `StateChangeIssueEvent` rendering
- Bug: pr review avatar render
- Feature: 使用 non-blocking cpu 状态统计 HOT 1
- Feature: diff code block wrap line
- tortoise.exceptions.OperationalError: 关系 "user" 不存在 HOT 1
- Feature: 支持 QQ 官方机器人接口
- 私聊使用 /install 后报错 HOT 4
- Security: Please enable Autoescaping for Jinja2 HOT 2
- Feature:支持使用 `/detail` 指令显示展开后的内容 HOT 1
- Bug: Pull Request 合并事件所渲染图片中合并者错误
- Bug: github context re-enter error
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from qq-github-bot.