Closed haotian2004 closed 2 years ago
File "/home/pi/.local/lib/python3.9/site-packages/nonebot/adapters/cqhttp/bot.py", line 369, in _call_api raise ApiNotAvailable nonebot.adapters.cqhttp.exception.ApiNotAvailable
- http: # HTTP 通信设置 host: 127.0.0.1 # 服务端监听地址 port: 5700 # 服务端监听端口
使用 HTTP 通讯方式,请在 .env 中添加:
API_ROOT={"1366840787": "http://127.0.0.1:5700"}
没有其他问题就先 close 了
日志 python3.9 bot.py 03-05 18:38:35 [SUCCESS] nonebot | NoneBot is initializing... 03-05 18:38:35 [INFO] nonebot | Current Env: prod 03-05 18:38:35 [DEBUG] nonebot | Loaded Config: {'driver': 'nonebot.drivers.fastapi', 'host': IPv4Address('127.0.0.1'), 'port': 8080, 'debug': True, 'log_level': None, 'api_root': {}, 'api_timeout': 30.0, 'access_token': 'nyada_miya', 'secret': None, 'superusers': {'3210467831'}, 'nickname': {'Omega_miya', 'omega_miya'}, 'command_start': {'/'}, 'command_sep': {'.'}, 'session_expire_timeout': datetime.timedelta(seconds=60), 'proxy_check_timeout': 5, 'saucenao_api_key': '', 'aes_key': 'test_key', 'proxy_check_url': 'https://www.google.com', 'db_port': 3306, 'bili_csrf': '', 'bili_uid': '', 'db_name': 'omega', 'db_tableprefix': 'omega', 'enable_proxy': False, 'secret_key': '', 'enable_forced_proxy': False, 'bili_sessdata': '', 'proxy_port': 1081, 'db_host': '127.0.0.1', 'db_user': 'root', 'secret_id': '', 'db_password': 'sht20040408', 'proxy_address': '127.0.0.1', 'pixiv_phpsessid': '', 'environment': 'prod'} 03-05 18:38:36 [DEBUG] nonebot | Succeeded to load adapter "cqhttp" 03-05 18:38:41 [SUCCESS] nonebot | Succeeded to import "omega_processor" 03-05 18:38:43 [SUCCESS] nonebot | Succeeded to import "pixiv_utils" 03-05 18:38:43 [SUCCESS] nonebot | Succeeded to import "tencent_cloud_api" 03-05 18:38:43 [SUCCESS] nonebot | Succeeded to import "omega_plugin_utils" 03-05 18:38:43 [SUCCESS] nonebot | Succeeded to import "bilibili_utils" 03-05 18:38:43 [SUCCESS] nonebot | Succeeded to import "nhentai_utils" 03-05 18:38:43 [SUCCESS] nonebot | Succeeded to import "omega_multibot_support" 03-05 18:38:43 [SUCCESS] nonebot | Succeeded to import "dice_utils" 03-05 18:38:44 [SUCCESS] nonebot | Succeeded to import "nonebot_plugin_apscheduler" 03-05 18:38:44 [SUCCESS] nonebot | Succeeded to import "zhoushen_hime" 03-05 18:38:44 [SUCCESS] nonebot | Succeeded to import "nhentai" 03-05 18:38:44 [SUCCESS] nonebot | Succeeded to import "tarot" /home/pi/.local/lib/python3.9/site-packages/apscheduler/util.py:95: PytzUsageWarning: The zone attribute is specific to pytz's interface; please migrate to a new time zone provider. For more details on how to do so, see https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html if obj.zone == 'local': 03-05 18:38:45 [SUCCESS] nonebot | Succeeded to import "pixiv_monitor" 03-05 18:38:45 [SUCCESS] nonebot | Succeeded to import "omega_email" 03-05 18:38:45 [SUCCESS] nonebot | Succeeded to import "omega_recaller" 03-05 18:38:45 [DEBUG] omega_manager | 初始化 Omega 后台任务... 03-05 18:38:45 [INFO] omega_manager | HTTP 代理: 已禁用! 03-05 18:38:45 [SUCCESS] nonebot | Succeeded to import "omega_manager" 03-05 18:38:45 [SUCCESS] nonebot | Succeeded to import "http_cat" 03-05 18:38:45 [SUCCESS] nonebot | Succeeded to import "pixiv" 03-05 18:38:45 [SUCCESS] nonebot | Succeeded to import "calculator" 03-05 18:38:45 [SUCCESS] nonebot | Succeeded to import "su_self_sent" 03-05 18:38:59 [SUCCESS] nonebot | Succeeded to import "omega_statistic" /home/pi/.local/lib/python3.9/site-packages/apscheduler/util.py:95: PytzUsageWarning: The zone attribute is specific to pytz's interface; please migrate to a new time zone provider. For more details on how to do so, see https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html if obj.zone == 'local': 03-05 18:38:59 [SUCCESS] nonebot | Succeeded to import "pixivsion_monitor" 03-05 18:38:59 [SUCCESS] nonebot | Succeeded to import "self_mute" 03-05 18:38:59 [SUCCESS] nonebot | Succeeded to import "maybe" 03-05 18:38:59 [SUCCESS] nonebot | Succeeded to import "omega_skill" 03-05 18:38:59 [SUCCESS] nonebot | Succeeded to import "search_anime" 03-05 18:38:59 [SUCCESS] nonebot | Succeeded to import "nbnhhsh" 03-05 18:38:59 [SUCCESS] nonebot | Succeeded to import "omega_help" 03-05 18:38:59 [SUCCESS] nonebot | Succeeded to import "setu" 03-05 18:38:59 [SUCCESS] nonebot | Succeeded to import "bilibili_dynamic_monitor" 03-05 18:38:59 [SUCCESS] nonebot | Succeeded to import "draw" 03-05 18:38:59 [SUCCESS] nonebot | Succeeded to import "miya_button" 03-05 18:38:59 [SUCCESS] nonebot | Succeeded to import "omega_auth_manager" 03-05 18:38:59 [SUCCESS] nonebot | Succeeded to import "omega_rate_limiting" 03-05 18:38:59 [SUCCESS] nonebot | Succeeded to import "omega_invite_manager" 03-05 18:38:59 [SUCCESS] nonebot | Succeeded to import "omega_welcome_msg" 03-05 18:38:59 [SUCCESS] nonebot | Succeeded to import "roll" 03-05 18:38:59 [SUCCESS] nonebot | Succeeded to import "tencent_cloud" 03-05 18:38:59 [SUCCESS] nonebot | Succeeded to import "omega_plugins_manager" 03-05 18:38:59 [SUCCESS] nonebot | Succeeded to import "omega_vacation" 03-05 18:38:59 [SUCCESS] nonebot | Succeeded to import "omega_anti_flash" 03-05 18:38:59 [SUCCESS] nonebot | Succeeded to import "shindan_maker" 03-05 18:38:59 [SUCCESS] nonebot | Succeeded to import "sticker_maker" 03-05 18:38:59 [SUCCESS] nonebot | Succeeded to import "omega_anti_recall" 03-05 18:38:59 [SUCCESS] nonebot | Succeeded to import "announce" 03-05 18:38:59 [SUCCESS] nonebot | Succeeded to import "omega_sign_in" 03-05 18:39:00 [SUCCESS] nonebot | Succeeded to import "bilibili_live_monitor" 03-05 18:39:00 [SUCCESS] nonebot | Succeeded to import "repeater" 03-05 18:39:00 [SUCCESS] nonebot | Succeeded to import "search_image" 03-05 18:39:00 [SUCCESS] nonebot | Succeeded to import "schedule_message" 03-05 18:39:00 [SUCCESS] nonebot | Running NoneBot... 03-05 18:39:00 [DEBUG] nonebot | Loaded adapters: cqhttp 03-05 18:39:00 [INFO] uvicorn | Started server process [70010] 03-05 18:39:00 [INFO] uvicorn | Waiting for application startup. 03-05 18:39:00 [INFO] omega_miya | 正在初始化数据库...... 03-05 18:39:00 [SUCCESS] omega_miya | 数据库初始化已完成. 03-05 18:39:01 [INFO] omega_plugin_utils | Fragment process | Startup Init Plugins processing: 1/1 03-05 18:39:01 [SUCCESS] omega_plugin_utils | Fragment process | Startup Init Plugins process complete, total tasks: 50 03-05 18:39:01 [SUCCESS] omega_processor | 插件信息初始化已完成. /home/pi/.local/lib/python3.9/site-packages/apscheduler/triggers/cron/init.py:146: PytzUsageWarning: The normalize method is no longer necessary, as this time zone supports the fold attribute (PEP 495). For more details on migrating to a PEP 495-compliant implementation, see https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html return self.timezone.normalize(dateval + difference), fieldnum /home/pi/.local/lib/python3.9/site-packages/apscheduler/triggers/cron/init.py:159: PytzUsageWarning: The localize method is no longer necessary, as this time zone supports the fold attribute (PEP 495). For more details on migrating to a PEP 495-compliant implementation, see https://pytz-deprecation-shim.readthedocs.io/en/latest/migration.html return self.timezone.localize(datetime(*values)) 03-05 18:39:01 [INFO] nonebot_plugin_apscheduler | Scheduler Started 03-05 18:39:01 [WARNING] bilibili_live_monitor | Bilibili 登录状态异常: No cookies configs! 建议在配置中正确设置cookies! 03-05 18:39:01 [INFO] bilibili_live_monitor | init_live_info: 初始化B站直播间监控列表... 03-05 18:39:01 [INFO] bilibili_live_monitor | init_live_info: B站直播间监控列表初始化完成. 03-05 18:39:01 [INFO] uvicorn | Application startup complete. 03-05 18:39:01 [INFO] uvicorn | Uvicorn running on http://127.0.0.1:8080 (Press CTRL+C to quit) 03-05 18:39:20 [DEBUG] bilibili_dynamic_monitor | bilibili_dynamic_monitor: checking started 03-05 18:39:20 [DEBUG] bilibili_dynamic_monitor | bilibili_dynamic_monitor: no dynamic subscription, ignore. 03-05 18:39:25 [INFO] uvicorn | 127.0.0.1:50290 - "POST /cqhttp/http HTTP/1.1" 204 03-05 18:39:30 [DEBUG] bilibili_live_monitor | bilibili_live_monitor: checking started 03-05 18:39:30 [DEBUG] bilibili_live_monitor | bilibili_live_monitor: no live subscription, ignore. 03-05 18:39:30 [INFO] uvicorn | 127.0.0.1:50290 - "POST /cqhttp/http HTTP/1.1" 204 03-05 18:39:35 [INFO] uvicorn | 127.0.0.1:50290 - "POST /cqhttp/http HTTP/1.1" 204 03-05 18:39:40 [DEBUG] bilibili_dynamic_monitor | bilibili_dynamic_monitor: checking started 03-05 18:39:40 [DEBUG] bilibili_dynamic_monitor | bilibili_dynamic_monitor: no dynamic subscription, ignore. 03-05 18:39:40 [INFO] uvicorn | 127.0.0.1:50290 - "POST /cqhttp/http HTTP/1.1" 204 03-05 18:39:41 [INFO] uvicorn | 127.0.0.1:50290 - "POST /cqhttp/http HTTP/1.1" 204 03-05 18:39:41 [SUCCESS] nonebot | CQHTTP 1366840787 | [message.private.friend]: Message -756093723 from 3210467831 "/omega" 03-05 18:39:41 [DEBUG] nonebot | Running PreProcessors... 03-05 18:39:41 [DEBUG] nonebot | Checking for matchers in priority 10... 03-05 18:39:41 [INFO] nonebot | Event will be handled by <Matcher from omega_manager, type=message, priority=10, temp=False> 03-05 18:39:41 [DEBUG] nonebot | Running matcher <Matcher from omega_manager, type=message, priority=10, temp=False> 03-05 18:39:41 [DEBUG] nonebot | Running handler <Handler _strip_cmd(bot: Bot, event: Event, state: typing.Dict[typing.Any, typing.Any], matcher: None)> 03-05 18:39:41 [DEBUG] nonebot | Running handler <Handler handle_first_receive(bot: <class 'nonebot.adapters.cqhttp.bot.Bot'>, event: <class 'nonebot.adapters.cqhttp.event.MessageEvent'>, state: typing.Dict[typing.Any, typing.Any], matcher: None)> 03-05 18:39:41 [DEBUG] nonebot | CQHTTP | Calling API send_msg 03-05 18:39:41 [INFO] nonebot | Matcher <Matcher from omega_manager, type=message, priority=10, temp=False> running complete 03-05 18:39:41 [ERROR] nonebot | Running matcher <Matcher from omega_manager, type=message, priority=10, temp=False> failed. Traceback (most recent call last): File "/home/pi/Desktop/omega-miya/bot.py", line 66, in
nonebot.run()
File "/home/pi/.local/lib/python3.9/site-packages/nonebot/init.py", line 278, in run
get_driver().run(host, port, args, **kwargs)
File "/home/pi/.local/lib/python3.9/site-packages/nonebot/drivers/fastapi.py", line 256, in run
uvicorn.run(
File "/home/pi/.local/lib/python3.9/site-packages/uvicorn/main.py", line 447, in run
server.run()
File "/home/pi/.local/lib/python3.9/site-packages/uvicorn/server.py", line 68, in run
return asyncio.run(self.serve(sockets=sockets))
File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/home/pi/.local/lib/python3.9/site-packages/nonebot/message.py", line 128, in _check_matcher
await _run_matcher(Matcher, bot, event, state)
go-cqhttp日志 pi@raspberrypi:~ $ cd Desktop/go-cq/ pi@raspberrypi:~/Desktop/go-cq $ ./go-cqhttp -faststart
[2022-03-05 18:39:17] [INFO]: 将使用 device.json 内的设备信息运行Bot.
[2022-03-05 18:39:17] [INFO]: 使用协议: iPad [2022-03-05 18:39:17] [INFO]: Protocol -> connect to server: 221.198.69.96:8080 [2022-03-05 18:39:19] [INFO]: 登录成功 欢迎使用: haoxiao666
[2022-03-05 18:39:19] [INFO]: 共加载 3 个好友.
[2022-03-05 18:39:19] [INFO]: 共加载 1 个群. [2022-03-05 18:39:20] [INFO]: 资源初始化完成, 开始处理信息.
[2022-03-05 18:39:20] [INFO]: HTTP POST上报器已启动: http://127.0.0.1:8080/cqhttp/http [2022-03-05 18:39:20] [INFO]: CQ HTTP 服务器已启动: 127.0.0.1:5700 [2022-03-05 18:39:20] [INFO]: 检查更新完成. 当前已运行最新版本.
[2022-03-05 18:39:27] [INFO]: 网络诊断完成. 未发现问题 [2022-03-05 18:39:41] [INFO]: 收到好友 /dev/null(3210467831) 的消息: /omega (-756093723)
连接方式:http
go-cqhttp config文件:
account: # 账号相关 uin: 1366840787 # QQ账号 password: '' # 密码为空时使用扫码登录 encrypt: false # 是否开启密码加密 status: 0 # 在线状态 请参考 https://docs.go-cqhttp.org/guide/config.html#在线状态 relogin: # 重连设置 delay: 3 # 首次重连延迟, 单位秒 interval: 3 # 重连间隔 max-times: 0 # 最大重连次数, 0为无限制
是否使用服务器下发的新地址进行重连
注意, 此设置可能导致在海外服务器上连接情况更差
use-sso-address: true
是否允许发送临时会话消息
allow-temp-session: false
heartbeat:
心跳频率, 单位秒
-1 为关闭心跳
interval: 5
message:
上报数据类型
可选: string,array
post-format: array
是否忽略无效的CQ码, 如果为假将原样发送
ignore-invalid-cqcode: false
是否强制分片发送消息
分片发送将会带来更快的速度
但是兼容性会有些问题
force-fragment: false
是否将url分片发送
fix-url: false
下载图片等请求网络代理
proxy-rewrite: ''
是否上报自身消息
report-self-message: false
移除服务端的Reply附带的At
remove-reply-at: false
为Reply附加更多信息
extra-reply-data: false
跳过 Mime 扫描, 忽略错误数据
skip-mime-scan: false
output:
日志等级 trace,debug,info,warn,error
log-level: warn
日志时效 单位天. 超过这个时间之前的日志将会被自动删除. 设置为 0 表示永久保留.
log-aging: 15
是否在每次启动时强制创建全新的文件储存日志. 为 false 的情况下将会在上次启动时创建的日志文件续写
log-force-new: true
是否启用日志颜色
log-colorful: true
是否启用 DEBUG
debug: false # 开启调试模式
默认中间件锚点
default-middlewares: &default
访问密钥, 强烈推荐在公网的服务器设置
access-token: 'nyada_miya'
事件过滤器文件目录
filter: ''
API限速设置
该设置为全局生效
原 cqhttp 虽然启用了 rate_limit 后缀, 但是基本没插件适配
目前该限速设置为令牌桶算法, 请参考:
https://baike.baidu.com/item/%E4%BB%A4%E7%89%8C%E6%A1%B6%E7%AE%97%E6%B3%95/6597000?fr=aladdin
rate-limit: enabled: false # 是否启用限速 frequency: 1 # 令牌回复频率, 单位秒 bucket: 1 # 令牌桶大小
database: # 数据库相关设置 leveldb:
是否启用内置leveldb数据库
媒体文件缓存, 删除此项则使用缓存文件(旧版行为)
cache: image: data/image.db video: data/video.db
连接服务列表
servers:
添加方式,同一连接方式可添加多个,具体配置说明请查看文档
- http: # http 通信
- ws: # 正向 Websocket
- ws-reverse: # 反向 Websocket
- pprof: #性能分析服务器
- url: '' # 地址
secret: '' # 密钥
max-retries: 3 # 最大重试,0 时禁用
retries-interval: 1500 # 重试时间,单位毫秒,0 时立即
- url: http://127.0.0.1:5701/ # 地址
secret: '' # 密钥
max-retries: 10 # 最大重试,0 时禁用
retries-interval: 1000 # 重试时间,单位毫秒,0 时立即
.env.prod :
HOST=127.0.0.1 PORT=8080 ACCESS_TOKEN=nyada_miya DEBUG=true SUPERUSERS=["3210467831"] NICKNAME=["omega_miya", "Omega_miya"] COMMAND_START=["/"] COMMAND_SEP=["."] SESSION_EXPIRE_TIMEOUT=60
Custom Configs
MySQL配置
DB_USER=root DB_PASSWORD= DB_HOST=127.0.0.1 DB_PORT=3306 DB_NAME=omega DB_TABLEPREFIX=omega
全局AES加密密钥
AES_KEY=test_key
B站相关插件Cookie配置(可选)
建议您正确配置此项来降低B站动态及直播间中可能的风控限制
BILI_UID= BILI_SESSDATA= BILI_CSRF=
全局HTTP代理配置
若ENABLE_FORCED_PROXY设置为False, 则当启用 HTTP 代理后当代理不可用时自动使用直连网络(默认)
若ENABLE_FORCED_PROXY设置为True, 则当启用 HTTP 代理后当代理不可用时仍不会使用直连网络
ENABLE_PROXY=false ENABLE_FORCED_PROXY=false PROXY_ADDRESS=127.0.0.1 PROXY_PORT=1081 PROXY_CHECK_URL=https://www.google.com PROXY_CHECK_TIMEOUT=5
腾讯云API配置
SECRET_ID= SECRET_KEY=
识图插件 Saucenao API KEY
SAUCENAO_API_KEY=
Pixiv Cookie配置
P站Cookie配置, 不填也行, 就是r18多图作品获取不到全部图片链接, 另外请确认P站用户设置-浏览限制中启用r18显示
PIXIV_PHPSESSID=