JQ-Networks/UnifiedMessageRelay

[WARNING](daemon.py:128): Could not reach Coolq-http-api, keep waiting...

w0330t opened this issue · 13 comments

使用的docker配置的,因为不会使用docker-compose 所以是直接用 https://cqhttp.cc/docs/4.4/#/Docker
的方法配置的一个docker。
测试下方的API测试可以使用
http://192.168.1.10:5700/send_private_msg?user_id=123456&message=你好
该API返回
{"data":{"message_id":300},"retcode":0,"status":"ok"}
自己构建了coolq-telegram-bot的docker镜像并且把coolq的目录弄了进去,Dockerfile内容如下

FROM python:3

WORKDIR /usr/src/coolq-telegram-bot

COPY requirements.txt ./
RUN pip install --no-cache-dir -r requirements.txt

COPY . .

CMD [ "python", "./daemon.py", "run" ]

然后docker一直如标题所示报错
[WARNING](daemon.py:128): Could not reach Coolq-http-api, keep waiting...

我原本以为是API没通,但是测试是正常的,请问如何调试或者解决

PS:我在coolq的config.ini里设置过token,为啥http的API没有验证这个token

谢谢~

Z4HD commented
{
    "DEBUG_MODE": true,
    "BAIDU_API": "asdasdaasd",
    "API_ROOT": "http://127.0.0.1:5700/",
    "ACCESS_TOKEN": "XXXXXXX",
    "SECRET": "",
    "HOST": "127.0.0.1",
    "PORT": 8080,
    "TOKEN": "机器人号",
    "QQ_BOT_ID": "QQ号",
    "FORWARD_LIST": [
        {
            "QQ": 12213234234,
            "TG": -2323143534534645,
            "DRIVE_MODE": false,
            "IMAGE_LINK": true
        },
        {
            "QQ": 12345678,
            "TG": -123456789,
            "DRIVE_MODE": false,
            "IMAGE_LINK": true
        }
    ],
    "USE_SHORT_URL": true,
    "SERVER_PIC_URL": "http://expample.com/image/",
    "CQ_ROOT": "/home/user/coolq/",
    "PROXY_URL": false
}

json的配置如此,麻烦帮忙看看啥地方有问题?
nginx没配置,所以暂时没动。
"API_ROOT": "http://127.0.0.1:5700/"
这个没动,我想估计没问题啊

Z4HD commented

@w0330t
API_ROOT 配置有问题,你这么写Bot只能向其所在容器内的5700端口发送请求。

Z4HD commented

@w0330t 话说你这么写会因为没装 FFMPEG 导致无法从TG向QQ转发GIF,可以拿CTB根目录下的Dockerfile试试。

我重新构建了镜像,我想问问如果再创建容器的时候使用--net=host参数会不会有什么问题?

Z4HD commented

@w0330t 容器与宿主机隔离的不彻底,故不推荐这种用法,,,

这个问题解决了,然后我在telegram输入 !!show commands 没有任何回应,

唯一的错误好像是这个,然而我好像不用相关的功能。

Can't update namelist, coolq error retcode=102
        You may need to check cqhttp's logs in app/io.github.richardchien.coolqhttpapi/log/xxxxx.log
        For more information: https://github.com/jqqqqqqqqqq/coolq-telegram-bot/issues/48

下面是日志

[CTB.Main.jsonConstantSupport][INFO] (bot_constant.py:39): [CTBot] JSON Config file support [Enable]
[CTB.Main][DEBUG] (daemon.py:169): Now running in debug mode...
[telegram.ext.dispatcher][DEBUG] (dispatcher.py:131): Setting singleton dispatcher as <telegram.ext.dispatcher.Dispatcher object at 0x7f34113fb438>
[JobQueue][DEBUG] (jobqueue.py:267): JobQueue thread started
[telegram.ext.updater][DEBUG] (updater.py:147): dispatcher - started
[telegram.ext.updater][DEBUG] (updater.py:147): updater - started
[telegram.ext.updater][DEBUG] (updater.py:264): Updater thread started (polling)
[telegram.ext.updater][DEBUG] (updater.py:308): Start network loop retry bootstrap del webhook
[telegram.bot][DEBUG] (bot.py:59): Entering: delete_webhook
[telegram.vendor.ptb_urllib3.urllib3.connectionpool][DEBUG] (connectionpool.py:835): Starting new HTTPS connection (1): api.telegram.org
[telegram.ext.dispatcher][DEBUG] (dispatcher.py:209): Dispatcher started
[CQHTTP][DEBUG] (__init__.py:157): Running on Host: 127.0.0.1, Port 8080, kwargs: {}
Bottle v0.12.13 server starting up (using WSGIRefServer())...
Listening on http://127.0.0.1:8080/
Hit Ctrl-C to quit.

[CTB.Main][INFO] (daemon.py:130): Coolq-http-api status: ok
[CTB.Main][INFO] (daemon.py:133): Coolq air detected
[CTB.plugins.qq_namelist][DEBUG] (qq_namelist.py:13): plugins.qq_namelist loading
[CTB.main.command][DEBUG] (command.py:55): Registering new command: update namelist(update_namelist)
[CTB.main.command][DEBUG] (command.py:73): update namelist(update_namelist) added to global_vars
[CTB.plugins.qq_namelist][INFO] (qq_namelist.py:20): [12213234234]Try to update qq namelist
[CTB.plugins.qq_namelist][DEBUG] (qq_namelist.py:26): Traceback (most recent call last):
  File "/usr/src/app/plugins/qq_namelist.py", line 23, in reload_qq_namelist
    group_id=gid_qq)
  File "/usr/src/app/cqhttp/__init__.py", line 56, in __call__
    raise _error(resp.status_code, data.get('retcode'))
cqhttp.Error102

[CTB.plugins.qq_namelist][ERROR] (qq_namelist.py:30): Can't update namelist, coolq error retcode=102
        You may need to check cqhttp's logs in app/io.github.richardchien.coolqhttpapi/log/xxxxx.log
        For more information: https://github.com/jqqqqqqqqqq/coolq-telegram-bot/issues/48
[CTB.plugins.qq_namelist][INFO] (qq_namelist.py:20): [12345678]Try to update qq namelist
[CTB.plugins.qq_namelist][DEBUG] (qq_namelist.py:26): Traceback (most recent call last):
  File "/usr/src/app/plugins/qq_namelist.py", line 23, in reload_qq_namelist
    group_id=gid_qq)
  File "/usr/src/app/cqhttp/__init__.py", line 56, in __call__
    raise _error(resp.status_code, data.get('retcode'))
cqhttp.Error102

[CTB.plugins.qq_namelist][ERROR] (qq_namelist.py:30): Can't update namelist, coolq error retcode=102
        You may need to check cqhttp's logs in app/io.github.richardchien.coolqhttpapi/log/xxxxx.log
        For more information: https://github.com/jqqqqqqqqqq/coolq-telegram-bot/issues/48
[CTB.plugins.show_group_id][DEBUG] (show_group_id.py:9): plugins.show_group_id loading
[CTB.main.command][DEBUG] (command.py:55): Registering new command: show group id(show_tg_group_id)
[CTB.main.command][DEBUG] (command.py:73): show group id(show_tg_group_id) added to global_vars
[CTB.main.command][DEBUG] (command.py:55): Registering new command: show group id(show_qq_group_id)
[CTB.main.command][DEBUG] (command.py:73): show group id(show_qq_group_id) added to global_vars
[CTB.plugins.for_fun][DEBUG] (for_fun.py:9): plugins.for_fun loading
[CTB.main.command][DEBUG] (command.py:55): Registering new command: dice(dice)
[CTB.main.command][DEBUG] (command.py:73): dice(dice) added to global_vars
[CTB.main.command][DEBUG] (command.py:55): Registering new command: rps(rps)
[CTB.main.command][DEBUG] (command.py:73): rps(rps) added to global_vars
[CTB.main.command][DEBUG] (command.py:55): Registering new command: alipay(show_red_pack)
[CTB.main.command][DEBUG] (command.py:73): alipay(show_red_pack) added to global_vars
[CTB.plugins.recall][DEBUG] (recall.py:10): plugins.recall loading
[CTB.main.command][DEBUG] (command.py:55): Registering new command: recall(recall)
[CTB.main.command][DEBUG] (command.py:73): recall(recall) added to global_vars
[CTB.plugins._002_water_meter_control][DEBUG] (_002_water_meter_control.py:12): plugins._002_water_meter_control loading
[CTB.plugins._002_water_meter_control][DEBUG] (_002_water_meter_control.py:19): Begin loading water meter config
[CTB.plugins._002_water_meter_control][DEBUG] (_002_water_meter_control.py:178): plugins._002_water_meter_control loaded
[CTB.plugins._000_admins][DEBUG] (_000_admins.py:12): plugins._000_admins loading
[CTB.plugins._000_admins][DEBUG] (_000_admins.py:19): Begin loading admin list
[CTB.plugins._000_admins][DEBUG] (_000_admins.py:93): plugins._000_admins loaded
[CTB.plugins._001_group_invite][DEBUG] (_001_group_invite.py:13): plugins._001_group_invite loading
[CTB.plugins._1002_command][DEBUG] (_1002_command.py:12): plugins._1002_command loading
[CTB.main.command][DEBUG] (command.py:55): Registering new command: show commands(command_qq_cmd)
[CTB.main.command][DEBUG] (command.py:73): show commands(command_qq_cmd) added to global_vars
[CTB.main.command][DEBUG] (command.py:55): Registering new command: show commands(command_tg_cmd)
[CTB.main.command][DEBUG] (command.py:73): show commands(command_tg_cmd) added to global_vars
[CTB.main.command][DEBUG] (command.py:55): Registering new command: help(command_qq_h)
[CTB.main.command][DEBUG] (command.py:73): help(command_qq_h) added to global_vars
[CTB.main.command][DEBUG] (command.py:55): Registering new command: help(command_tg_h)
[CTB.main.command][DEBUG] (command.py:73): help(command_tg_h) added to global_vars
[CTB.plugins._1001_filter_old_message][DEBUG] (_1001_filter_old_message.py:12): plugins._1001_filter_old_message loading
[CTB.plugins._1005_drive_mode][DEBUG] (_1005_drive_mode.py:14): plugins._1005_drive_mode loading
[CTB.main.command][DEBUG] (command.py:55): Registering new command: drive mode on(drive_mode_on)
[CTB.main.command][DEBUG] (command.py:73): drive mode on(drive_mode_on) added to global_vars
[CTB.main.command][DEBUG] (command.py:55): Registering new command: drive mode off(drive_mode_off)
[CTB.main.command][DEBUG] (command.py:73): drive mode off(drive_mode_off) added to global_vars
[CTB.plugins._1006_water_meter_filter][DEBUG] (_1006_water_meter_filter.py:11): plugins._1006_water_meter_filter loading
[CTB.plugins._1100_text_forward][DEBUG] (_1100_text_forward.py:23): plugins._1100_text_forward loading
[CTB.main.command][DEBUG] (command.py:55): Registering new command: image link on(pic_link_on)
[CTB.main.command][DEBUG] (command.py:73): image link on(pic_link_on) added to global_vars
[CTB.main.command][DEBUG] (command.py:55): Registering new command: image link off(pic_link_off)
[CTB.main.command][DEBUG] (command.py:73): image link off(pic_link_off) added to global_vars
[CTB.plugins._1101_other_qq_group_events][DEBUG] (_1101_other_qq_group_events.py:9): plugins._1101_other_qq_group_events loading
[telegram.vendor.ptb_urllib3.urllib3.connectionpool][DEBUG] (connectionpool.py:412): https://api.telegram.org:443 "POST /bot579985803:AAGO5yc_tCqhNBF95TVYqUPwPsPkjBJgc38/deleteWebhook HTTP/1.1" 200 68
[telegram.bot][DEBUG] (bot.py:61): True
[telegram.bot][DEBUG] (bot.py:62): Exiting: delete_webhook
[telegram.ext.updater][DEBUG] (updater.py:268): Bootstrap done
[telegram.ext.updater][DEBUG] (updater.py:308): Start network loop retry getting Updates
[telegram.bot][DEBUG] (bot.py:59): Entering: get_updates
[telegram.vendor.ptb_urllib3.urllib3.connectionpool][DEBUG] (connectionpool.py:412): https://api.telegram.org:443 "POST /bot579985803:AAGO5yc_tCqhNBF95TVYqUPwPsPkjBJgc38/getUpdates HTTP/1.1" 200 346
[telegram.bot][DEBUG] (bot.py:1771): Getting updates: [143068436]
[telegram.bot][DEBUG] (bot.py:61): [<telegram.update.Update object at 0x7f340ed3c940>]
[telegram.bot][DEBUG] (bot.py:62): Exiting: get_updates
[telegram.ext.dispatcher][DEBUG] (dispatcher.py:227): Processing Update: {'update_id': 143068436, 'message': {'message_id': 10, 'date': 1534491757, 'chat': {'id': 219380599, 'type': 'private', 'username': 'w0330t', 'first_name': 'Blueness', 'last_name': 'Wen'}, 'text': '!!show commands', 'entities': [], 'caption_entities': [], 'photo': [], 'new_chat_members': [], 'new_chat_photo': [], 'delete_chat_photo': False, 'group_chat_created': False, 'supergroup_chat_created': False, 'channel_chat_created': False, 'from': {'id': 219380599, 'first_name': 'Blueness', 'is_bot': False, 'last_name': 'Wen', 'username': 'w0330t', 'language_code': 'zh-CN'}}}
[telegram.ext.conversationhandler][DEBUG] (conversationhandler.py:257): selecting conversation (219380599, 219380599) with state None
[telegram.ext.dispatcher][DEBUG] (dispatcher.py:284): Stopping further handlers due to DispatcherHandlerStop
[telegram.bot][DEBUG] (bot.py:59): Entering: get_updates

Z4HD commented
[CTB.plugins.qq_namelist][ERROR] (qq_namelist.py:30): Can't update namelist, coolq error retcode=102
        You may need to check cqhttp's logs in app/io.github.richardchien.coolqhttpapi/log/xxxxx.log
        For more information: https://github.com/jqqqqqqqqqq/coolq-telegram-bot/issues/48

我怀疑你群号填错了,或者你去 #48 看看?

我的问题是,为啥我在telegram对着机器人输入各种命令没有回复……
非要设置这个FORWARD_LIST么?为空的话啥功能也用不了?
这个bot的功能只能是对QQ群做一个转发?
文档里写着!!show commands !!cmd就可以显示所有命令,然而我输入后就没有任何回复了。

@w0330t 请检查bot的 group privacy settings,私聊 bot father

[telegram.ext.dispatcher][DEBUG] (dispatcher.py:227): Processing Update: {'update_id': 143068444, 'message': {'message_id': 20, 'date': 1534519570, 'chat': {'id': 219380599, 'type': 'private', 'username': 'w0330t', 'first_name': 'Blueness', 'last_name': 'Wen'}, 'text': '!!cmd', 'entities': [], 'caption_entities': [], 'photo': [], 'new_chat_members': [], 'new_chat_photo': [], 'delete_chat_photo': False, 'group_chat_created': False, 'supergroup_chat_created': False, 'channel_chat_created': False, 'from': {'id': 219380599, 'first_name': 'Blueness', 'is_bot': False, 'last_name': 'Wen', 'username': 'w0330t', 'language_code': 'zh-CN'}}}
[telegram.ext.conversationhandler][DEBUG] (conversationhandler.py:257): selecting conversation (219380599, 219380599) with state None
[telegram.ext.dispatcher][DEBUG] (dispatcher.py:284): Stopping further handlers due to DispatcherHandlerStop
[telegram.bot][DEBUG] (bot.py:59): Entering: get_updates
[telegram.vendor.ptb_urllib3.urllib3.connectionpool][DEBUG] (connectionpool.py:412): https://api.telegram.org:443 "POST /bot579985803:AAGO5yc_tCqhNBF95TVYqUPwPsPkjBJgc38/getUpdates HTTP/1.1" 200 346
[telegram.bot][DEBUG] (bot.py:1771): Getting updates: [143068445]
[telegram.bot][DEBUG] (bot.py:61): [<telegram.update.Update object at 0x7f57deed0278>]
[telegram.bot][DEBUG] (bot.py:62): Exiting: get_updates
[telegram.ext.dispatcher][DEBUG] (dispatcher.py:227): Processing Update: {'update_id': 143068445, 'message': {'message_id': 21, 'date': 1534519607, 'chat': {'id': 219380599, 'type': 'private', 'username': 'w0330t', 'first_name': 'Blueness', 'last_name': 'Wen'}, 'text': '!!show group id', 'entities': [], 'caption_entities': [], 'photo': [], 'new_chat_members': [], 'new_chat_photo': [], 'delete_chat_photo': False, 'group_chat_created': False, 'supergroup_chat_created': False, 'channel_chat_created': False, 'from': {'id': 219380599, 'first_name': 'Blueness', 'is_bot': False, 'last_name': 'Wen', 'username': 'w0330t', 'language_code': 'zh-CN'}}}
[telegram.ext.conversationhandler][DEBUG] (conversationhandler.py:257): selecting conversation (219380599, 219380599) with state None
[telegram.ext.dispatcher][DEBUG] (dispatcher.py:284): Stopping further handlers due to DispatcherHandlerStop
[telegram.bot][DEBUG] (bot.py:59): Entering: get_updates

依旧是神马都不显示……
以下是我发送的命令

Blueness Wen, [17.08.18 23:23]
!!cmd

Blueness Wen, [17.08.18 23:25]
!!cmd

Blueness Wen, [17.08.18 23:26]
!!cmd

以下是我修改之后的配置文件:

{
    "DEBUG_MODE": true,
    "BAIDU_API": "asdasdaasd",
    "API_ROOT": "http://172.17.0.1:5700/",
    "ACCESS_TOKEN": "xxxxx",
    "SECRET": "",
    "HOST": "172.17.0.1",
    "PORT": 8080,
    "TOKEN": "telegram token",
    "QQ_BOT_ID": "QQ号",
    "FORWARD_LIST": [],
    "USE_SHORT_URL": true,
    "SERVER_PIC_URL": "http://expample.com/image/",
    "CQ_ROOT": "/home/user/coolq/",
    "PROXY_URL": false
}

BotFather的配置已经设置
Group Privacy都调整为了off(默认on)

@jqqqqqqqqqq @Z4HD 大佬们我知道我这个很大概玄学,你们给个测试思路或者测试方法呗?我这东西搞得挺尴尬的,反正在telegram对着bot输入任何玩意都没有回应,只有日志上有显示。
group privacy settings无论设置成on还是off结果都这样。

Please open a new issue if the problem is still there.