JQ-Networks / UnifiedMessageRelay

Group Message Forward Framework (supports QQ Telegram Line Discord)
MIT License
419 stars 59 forks source link

QQ无法转发到TG #60

Closed FlyingSky-CN closed 5 years ago

FlyingSky-CN commented 5 years ago

排查了好久还是决定来发个Issue

症状描述

QQ消息无法转发到TG,但TG到QQ完全正常

python3 daemon.py run 的执行输出

[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 0x7f4943fc72e8>
[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): [712988048]Try to update qq namelist
[CTB.plugins.qq_namelist][INFO] (qq_namelist.py:32): [712988048]Successful update qq namelist
[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:23): Admin list loaded
[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 /bot692405440:AAGVOYj73MqAirpJpD3z63JAuNIoSRnVoHA/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
[CQHTTP][ERROR] (__init__.py:102): 401: X-Signature not in headers
127.0.0.1 - - [26/Jan/2019 23:02:57] "POST / HTTP/1.1" 401 716
[CQHTTP][ERROR] (__init__.py:117): 400: Wrong post_type
127.0.0.1 - - [26/Jan/2019 23:02:57] "POST / HTTP/1.1" 400 714
[telegram.vendor.ptb_urllib3.urllib3.connectionpool][DEBUG] (connectionpool.py:412): https://api.telegram.org:443 "POST /bot692405440:AAGVOYj73MqAirpJpD3z63JAuNIoSRnVoHA/getUpdates HTTP/1.1" 200 23
[telegram.bot][DEBUG] (bot.py:1773): No new updates found.
[telegram.bot][DEBUG] (bot.py:61): []
[telegram.bot][DEBUG] (bot.py:62): Exiting: get_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 /bot692405440:AAGVOYj73MqAirpJpD3z63JAuNIoSRnVoHA/getUpdates HTTP/1.1" 200 23
[telegram.bot][DEBUG] (bot.py:1773): No new updates found.
[telegram.bot][DEBUG] (bot.py:61): []
[telegram.bot][DEBUG] (bot.py:62): Exiting: get_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 /bot692405440:AAGVOYj73MqAirpJpD3z63JAuNIoSRnVoHA/getUpdates HTTP/1.1" 200 23
[telegram.bot][DEBUG] (bot.py:1773): No new updates found.
[telegram.bot][DEBUG] (bot.py:61): []
[telegram.bot][DEBUG] (bot.py:62): Exiting: get_updates
[telegram.bot][DEBUG] (bot.py:59): Entering: get_updates

部署方式

Docker ,主分支

配置文件

bot_constant.json

# -*- coding: utf-8 -*-

DEBUG_MODE = True  # log will not take up much place, but it is necessary when locating problems

BAIDU_API = 'asdasdaasd'

# cq-http-api server config
API_ROOT = 'http://127.0.0.1:5700/'  # should be the same as cq-http-api api address
ACCESS_TOKEN = '1'  # should be the same as cq-http-api config
SECRET = '1'  # should be the same as cq-http-api config

# cq-http-api client config, should be the same as cq-http-api post config
HOST = '127.0.0.1'
PORT = 8080

TOKEN = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'
QQ_BOT_ID = 'xxxxxxxxxxxxxx'
FORWARD_LIST = [
    {'QQ': xxxxxxxxxxxxx,
     'TG': -xxxxxxxxxx,
     'DRIVE_MODE': False,
     'IMAGE_LINK': True}
]
USE_SHORT_URL = True
SERVER_PIC_URL = 'https://xxxxxxxxxx/image/'
CQ_ROOT = '/xxxxxxxxxxxxxxxx/docker/coolq/'
# if you need socks5 proxy, setup proxy_url as below
# PROXY_URL = 'socks5://127.0.0.1:1080/'
# if you don't need socks5 proxy, set an empty variable
PROXY_URL = ''

app/io.github.richardchien.coolqhttpapi/config.cfg

[general]
host=0.0.0.0
port=5700
use_http=yes
ws_host=0.0.0.0
ws_port=5700
use_ws=no
post_url=http://127.0.0.1:8080
access_token=1
secret=1
post_message_format=array
serve_data_files=no
update_channel=stable
auto_check_update=no
auto_perform_update=no

TG->QQ完全正常(包括 !!id/图片/消息 ) 然后我也注意到了python端的

[CQHTTP][ERROR] (__init__.py:102): 401: X-Signature not in headers
127.0.0.1 - - [26/Jan/2019 23:02:57] "POST / HTTP/1.1" 401 716
[CQHTTP][ERROR] (__init__.py:117): 400: Wrong post_type
127.0.0.1 - - [26/Jan/2019 23:02:57] "POST / HTTP/1.1" 400 714

coolq插件的日志也有

[2019-01-26 15:02:57.672] [W] [HTTP] 通过 HTTP 上报数据到 http://127.0.0.1:8080 失败,状态码:401
[2019-01-26 15:02:57.692] [I] [HTTP] 开启 HTTP 服务器成功,开始监听 http://0.0.0.0:5700
[2019-01-26 15:02:57.693] [I] [重启] HTTP API 插件重启成功
[2019-01-26 15:02:57.698] [W] [HTTP] 通过 HTTP 上报数据到 http://127.0.0.1:8080 失败,状态码:400
FlyingSky-CN commented 5 years ago

不用了,我解决了(