Coder Social home page Coder Social logo

jq-networks / unifiedmessagerelay Goto Github PK

View Code? Open in Web Editor NEW
415.0 21.0 64.0 1.83 MB

Group Message Forward Framework (supports QQ Telegram Line Discord)

License: MIT License

Python 100.00%
coolq-docker telegram coolq coolq-http-api telegram-bot qqbot line-bot line discord discord-bot asyncio python-asyncio quart

unifiedmessagerelay's Introduction

UnifiedMessageRelay

shields License: MIT Telegram support group Telegram developer group

UnifiedMessageRelay is a framework for the purpose of bringing messages from different chat platform together. With UnifiedMessageRelay, user no longer need to view messages on different platform, or different groups. UnifiedMessageRelay brings powerful message forwarding functionality and flexible plugin API to meet your custom need. A driver API specification is also provided, so one can compose their own backend driver, and the framework will load and utilize the driver automatically.

Demo

Telegram <-> QQ:

Telegram

QQ

Telegram <-> Discord:

Discord

Telegram

All four platforms: QQ, Telegram, Line and Discord can forward between each other directly.

Supported platforms

Update

ChangeLog.md

Features

  • Forward text and image between all supported platforms
  • Image is converted to supported format automatically
  • Reply is preserved with best effort
  • Markdown format is preserved for supported platforms
  • Command API for customize triggers
  • Message Hook API for even more customized needs

Limited support for Coolq Air. image sending is available for Coolq Pro.

Installation

Framework Setup

Install python dependencies on host os

Make sure Python 3.7+ and pip are installed. Run:

pip3 install unified-message-relay

TLDR

To install every python module in one line:

pip3 install -U umr_telegram_driver umr_line_driver umr_discord_driver umr_coolq_driver umr_mirai_driver umr_extensions_demo

Install other required package on host os

apt install libcairo2 ffmpeg libmagickwand-dev

Configurations

Create ~/.umr/

mkdir ~/.umr

Copy config.yaml to ~/.umr

Why yaml instead of json?

Full Example config

The "QQ", "Telegram" or "Line" above are all custom names. Real bot driver should be configure throgh "Driver" list.

Follow the guide for your platform

QQ

Mirai

Telegram

Line

Discord

Start the bot

Viewing CLI Help

unified_message_relay -h

Background process

  • Start background service
unified_message_relay start

or

unified-message-relay restart

By default, log will be stored in /var/log/umr/bot.log, and cache will be cleared out upon start.

  • Stop the background service
unified_message_relay stop

Foreground process (for debugging purpose)

If you need to see the log output for debugging purpose, stop the running daemon first. Then follow this command.

Remember to enable debug option in config.

unified_message_relay run

Hit Ctrl + C to stop.

Extensions and Commands

Example extensions and commands now require extension umr-extensions-demo:

pip install umr-extensions-demo

and put - umr_extensions_demo under Extensions section of config.yaml.

Available commands

Help

Send !!help to show available commands.

This command requires no extra module.

Show chat id

Send !!id anywhere to see chat id.

Reply message with !!id to reveal source chat id.

This command requires cmd_id.py under umr_extension_demo.

Delete QQ Message

Reply to the message you want to delete with !!del

This command requires QQ_recall.py under umr_extension_demo and using coolq driver. Mirai recall is not supported at this time.

Add telegram blocked keyword

Message containing these keyword will not be forwarded to any other chat

Send !!bk and keywords separated by space

This command requires Telegram_watermeter.py under umr_extension_demo and using telegram driver.

Add telegram blocked channel

Message originated from these channel will not be forwarded to any other chat

Reply forwarded channel message with !!bc

This command requires Telegram_watermeter.py under umr_extension_demo and using telegram driver.

To modify saved keywords and channels, edit ExtensionConfig section in config.yaml.

Available Extensions

Comment filter

Add // at the beginning of the message to avoid forwarding to any other chat.

Issue Format

Check these before opening an issue

  1. Use unified-message-relay run to print log to stdout
  2. Check if you are using Python 3.7+
  3. Check if binary dependencies are installed (search apt in this page)
  4. (If using Coolq) Check if cq-http-api is enabled in Coolq
  5. Check if the log suggests any missing configuration
  6. Check if you are on Dev branch, please switch back to master (dev may be unstable)

Issues must provide

  1. Descriptions about the issue
  2. Logs of python3 daemon.py run (Desensitization)
  3. Steps to reproduce

unifiedmessagerelay's People

Contributors

billchenchina avatar fledgexu avatar joglelew avatar jqqqqqqqqqq avatar llc1123 avatar milkice233 avatar moesoha avatar momo2366 avatar nickyc4 avatar runapp avatar stdrc avatar tttpob avatar wtdcode avatar xeonacid avatar z4hd avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

unifiedmessagerelay's Issues

不能转发「贴纸」

如题

以下是日志

[CTBot] JSON Config file support [Enable]
telegram.vendor.ptb_urllib3.urllib3.connectionpool: WARNING  Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response',))': /bot**********************************************************/getUpdates
telegram.vendor.ptb_urllib3.urllib3.connectionpool: WARNING  Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response',))': /bot**********************************************************/getUpdates
telegram.vendor.ptb_urllib3.urllib3.connectionpool: WARNING  Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response',))': /bot**********************************************************/getUpdates
telegram.vendor.ptb_urllib3.urllib3.connectionpool: WARNING  Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response',))': /bot**********************************************************/getUpdates
telegram.vendor.ptb_urllib3.urllib3.connectionpool: WARNING  Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response',))': /bot**********************************************************/getUpdates
Traceback (most recent call last):
  File "/home/user/coolq-telegram-bot/cqsdk.py", line 291, in handle
    listener.handler(message)):
  File "/home/user/coolq-telegram-bot/plugins/_003_debug_all_message.py", line 107, in test
    qq_group_id = int(message.group)
AttributeError: 'RcvGroupMemberList' object has no attribute 'group'
telegram.vendor.ptb_urllib3.urllib3.connectionpool: WARNING  Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response',))': /bot**********************************************************/getUpdates
telegram.vendor.ptb_urllib3.urllib3.connectionpool: WARNING  Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response',))': /bot**********************************************************/getUpdates
telegram.vendor.ptb_urllib3.urllib3.connectionpool: WARNING  Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response',))': /bot**********************************************************/getUpdates
telegram.vendor.ptb_urllib3.urllib3.connectionpool: WARNING  Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response',))': /bot**********************************************************/getUpdates
telegram.vendor.ptb_urllib3.urllib3.connectionpool: WARNING  Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response',))': /bot**********************************************************/getUpdates
telegram.vendor.ptb_urllib3.urllib3.connectionpool: WARNING  Retrying (Retry(total=1, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response',))': /bot**********************************************************/getUpdates

谢谢~

那个 顺便问下 QQ 群怎么发贴纸喵?
还有 上面的

telegram.vendor.ptb_urllib3.urllib3.connectionpool: WARNING  Retrying (Retry(total=2, connect=None, read=None, redirect=None)) after connection broken by 'ProxyError('Cannot connect to proxy.', RemoteDisconnected('Remote end closed connection without response',))': /bot**********************************************************/getUpdates

很烦 这是什么原因呢?

再次感谢你对这个项目的贡献

docker 方案部署时报错

制作ctb镜像时
Step 5/8 : RUN pipenv install -v
返回如下错误
File "/usr/local/bin/pipenv", line 11, in
sys.exit(cli())
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 722, in call
return self.main(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 697, in main
rv = self.invoke(ctx)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 1066, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 895, in invoke
return ctx.invoke(self.callback, **ctx.params)
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/click/core.py", line 535, in invoke
return callback(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/pipenv/cli.py", line 435, in install
selective_upgrade=selective_upgrade,
File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 1943, in do_install
pypi_mirror=pypi_mirror,
File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 1322, in do_init
pypi_mirror=pypi_mirror,
File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 813, in do_install_dependencies
cleanup_procs(procs, concurrent)
File "/usr/local/lib/python3.6/site-packages/pipenv/core.py", line 718, in cleanup_procs
click.echo(crayons.blue(c.out or c.err))
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/delegator.py", line 117, in err
return self._pexpect_out
File "/usr/local/lib/python3.6/site-packages/pipenv/vendor/delegator.py", line 85, in _pexpect_out
result += self.subprocess.after
TypeError: must be str, not type

执行pip3 install -r requirements.txt报错

之前有一次安装是可以的 但被我pip3 uninstall -r requirements.txt卸载了 然后想再安装就出现错误了 pip3重装了也不行 谁能告诉我大概是什么问题……

Collecting APScheduler==3.3.1 (from -r requirements.txt (line 1))
Downloading APScheduler-3.3.1-py2.py3-none-any.whl (56kB)
100% |████████████████████████████████| 61kB 3.3kB/s
Collecting beautifulsoup4==4.6.0 (from -r requirements.txt (line 2))
Downloading beautifulsoup4-4.6.0-py3-none-any.whl (86kB)
100% |████████████████████████████████| 92kB 6.9kB/s
Collecting certifi==2017.7.27.1 (from -r requirements.txt (line 3))
Downloading certifi-2017.7.27.1-py2.py3-none-any.whl (349kB)
67% |█████████████████████▋ | 235kB 3.8kB/s eta 0:00:31Exception:
Traceback (most recent call last):
File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/response.py", line 226, in _error_catcher
yield
File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/response.py", line 301, in read
data = self._fp.read(amt)
File "/usr/share/python-wheels/CacheControl-0.11.5-py2.py3-none-any.whl/cachecontrol/filewrapper.py", line 49, in read
data = self.__fp.read(amt)
File "/usr/lib/python3.5/http/client.py", line 448, in read
n = self.readinto(b)
File "/usr/lib/python3.5/http/client.py", line 488, in readinto
n = self.fp.readinto(b)
File "/usr/lib/python3.5/socket.py", line 575, in readinto
return self._sock.recv_into(b)
File "/usr/lib/python3.5/ssl.py", line 929, in recv_into
return self.read(nbytes, buffer)
File "/usr/lib/python3.5/ssl.py", line 791, in read
return self._sslobj.read(len, buffer)
File "/usr/lib/python3.5/ssl.py", line 575, in read
v = self._sslobj.read(len, buffer)
socket.timeout: The read operation timed out

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/usr/lib/python3/dist-packages/pip/basecommand.py", line 209, in main
status = self.run(options, args)
File "/usr/lib/python3/dist-packages/pip/commands/install.py", line 317, in run
requirement_set.prepare_files(finder)
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 360, in prepare_files
ignore_dependencies=self.ignore_dependencies))
File "/usr/lib/python3/dist-packages/pip/req/req_set.py", line 577, in _prepare_file
session=self.session, hashes=hashes)
File "/usr/lib/python3/dist-packages/pip/download.py", line 810, in unpack_url
hashes=hashes
File "/usr/lib/python3/dist-packages/pip/download.py", line 649, in unpack_http_url
hashes)
File "/usr/lib/python3/dist-packages/pip/download.py", line 871, in _download_http_url
_download_url(resp, link, content_file, hashes)
File "/usr/lib/python3/dist-packages/pip/download.py", line 595, in _download_url
hashes.check_against_chunks(downloaded_chunks)
File "/usr/lib/python3/dist-packages/pip/utils/hashes.py", line 46, in check_against_chunks
for chunk in chunks:
File "/usr/lib/python3/dist-packages/pip/download.py", line 563, in written_chunks
for chunk in chunks:
File "/usr/lib/python3/dist-packages/pip/utils/ui.py", line 139, in iter
for x in it:
File "/usr/lib/python3/dist-packages/pip/download.py", line 552, in resp_read
decode_content=False):
File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/response.py", line 344, in stream
data = self.read(amt=amt, decode_content=decode_content)
File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/response.py", line 311, in read
flush_decoder = True
File "/usr/lib/python3.5/contextlib.py", line 77, in exit
self.gen.throw(type, value, traceback)
File "/usr/share/python-wheels/urllib3-1.13.1-py2.py3-none-any.whl/urllib3/response.py", line 231, in _error_catcher
raise ReadTimeoutError(self._pool, None, 'Read timed out.')
requests.packages.urllib3.exceptions.ReadTimeoutError: HTTPSConnectionPool(host='pypi.python.org', port=443): Read timed out.

Update Licence

Contributors involved:
@jqqqqqqqqqq
@Z4HD
@richardchien
@milkice233
@billchenchina
@xyf1219
Please reply to this issue to confirm:

  1. Do you agree to change LICENCE from GPL to MIT?
MIT License

Copyright (c) 2018 Curtis Jiang

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
  1. Do you agree to change LICENCE from GPL to WTFPL?
        DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 
                    Version 2, December 2004 

 Copyright (C) 2018 Curtis Jiang

 Everyone is permitted to copy and distribute verbatim or modified 
 copies of this license document, and changing it is allowed as long 
 as the name is changed. 

            DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE 
   TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION 

  0. You just DO WHAT THE FUCK YOU WANT TO.

tg 与 qq 无法互联

1 用的是docker 镜像安装coolq air 的方法 能收到qq消息(但不明白是不是作者所说的容器内部运行)
2 执行python3 daemon.py start 没有报错 但是在tg 发送 [show commands] 、 [show group id] 没有反应。
不知道会是哪里有问题呢

Readme rot

Now support docker-compose, more details (Chinese)

the hyperlink on details is broken.

购买了酷Q pro,然而报错,无法转发图片。

root@7cf4b961237a:/home/user/coolq/coolq-telegram-bot# python3 daemon.py run
Traceback (most recent call last):
File "/home/user/coolq/coolq-telegram-bot/cqsdk.py", line 291, in handle
listener.handler(message)):
File "/home/user/coolq/coolq-telegram-bot/plugins/qq_namelist.py", line 19, in handle_group_member_list
with open(os.path.join(CQ_GROUP_LIST_ROOT, message.path.split('\')[-1]), 'r', encoding='utf-8') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/root/coolq-data/app/org.dazzyd.cqsocketapi/GroupListCache/1????????.g'
Traceback (most recent call last):
File "/home/user/coolq/coolq-telegram-bot/cqsdk.py", line 291, in handle
listener.handler(message)):
File "/home/user/coolq/coolq-telegram-bot/plugins/qq_namelist.py", line 19, in handle_group_member_list
with open(os.path.join(CQ_GROUP_LIST_ROOT, message.path.split('\')[-1]), 'r', encoding='utf-8') as f:
FileNotFoundError: [Errno 2] No such file or directory: '/root/coolq-data/app/org.dazzyd.cqsocketapi/GroupListCache/5???????????.g'
Update "None" caused error "Conflict: terminated by other long poll or webhook (409)"
Update "None" caused error "Conflict: terminated by other long poll or webhook (409)"

重装了,成功运行酷Q pro 然而报的错误和air时的一样,还是转发不了图片。

关于酷Q和windows环境。

在docker镜像内运行酷Q发现了很多问题,比如cool运行目录要打开写权限,不然很多酷Q应用会出错。
还有比如wine-qq的镜像对多国语言支持不好等等。
尝试将酷Q在win下运行,所有应用均正常了。
因为发现了酷Q社区,找到了很多有用的应用。比如图灵机器人,小I机器人,翻译,查快递,QQ群内百度

但是在win环境下,配置python环境遇到的困难太多了。各种pip的安装包版本不全等等。

弱弱的建议,可否出个可将酷Q和telegram-bot分离的方案?
比如酷Q运行在家里的软路由上exsi里面的win7虚拟机里,而telegram-bot运行在vps上的docker镜像里。

想法不太成熟,可能表达不太好,见谅。

巨巨,跪求解。关于coolq-telegram-bot

coolq已经跑起来了,私聊QQ机器人也有反应。
telegram的bot也建立了。填写了token和tg群ID。
bot_constant.py也修改过了。

TOKEN = '45??????????????????????Lk'
QQ_BOT_ID = 3???????????0
FORWARD_LIST = [
{
'QQ': 17???????????5,
'TG': -1001???????78,
'Drive_mode': False,
'Pic_link': False
},
{
'QQ': 17?????????5,
'TG': -1001??????????78,
'Drive_mode': False,
'Pic_link': False
},
]
SERVER_PIC_URL = 'http://example.com:8080/image/'
CQ_ROOT = '/root/coolq-data/'
CQ_PORT = 11235
JQ_MODE = False # if use Coolq Pro, set as True, otherwise False

然而转发bot运行起来没有效果?原因不明,我应该检查哪里啊?

无法从 QQ 转发到 tg

症状描述

文字 & 图片都无法转发
同时从 tg 也不能转发图片到 QQ

python3 daemon.py run 的执行输出

2017-12-23 13:57:37,210 [INFO] CTBMain - daemon(daemon.py) : Now running in debug mode...
2017-12-23 13:57:37,218 [DEBUG] telegram.ext.dispatcher - dispatcher(dispatcher.py) : Setting singleton dispatcher as <telegram.ext.dispatcher.Dispatcher object at 0x7f5b50f69d68>
2017-12-23 13:57:37,221 [DEBUG] telegram.ext.updater - updater(updater.py) : dispatcher - started
2017-12-23 13:57:37,222 [DEBUG] telegram.ext.updater - updater(updater.py) : updater - started
2017-12-23 13:57:37,223 [DEBUG] telegram.ext.updater - updater(updater.py) : Updater thread started
2017-12-23 13:57:37,225 [DEBUG] telegram.bot - bot(bot.py) : Entering: set_webhook
2017-12-23 13:57:37,227 [DEBUG] telegram.vendor.ptb_urllib3.urllib3.connectionpool - connectionpool(connectionpool.py) : Starting new HTTPS connection (1): api.telegram.org
Bottle v0.12.13 server starting up (using WSGIRefServer())...
Listening on http://127.0.0.1:8080/
Hit Ctrl-C to quit.

2017-12-23 13:57:37,232 [DEBUG] CTBPlugin.plugins.qq_namelist - qq_namelist(qq_namelist.py) : plugins.qq_namelist loading
2017-12-23 13:57:37,234 [DEBUG] CTBMain.command - command(command.py) : Registering new command: update namelist(update_namelist)
2017-12-23 13:57:37,234 [DEBUG] CTBMain.command - command(command.py) : update namelist(update_namelist) added to global_vars
2017-12-23 13:57:37,239 [DEBUG] telegram.ext.dispatcher - dispatcher(dispatcher.py) : Dispatcher started
2017-12-23 13:57:37,914 [DEBUG] telegram.vendor.ptb_urllib3.urllib3.connectionpool - connectionpool(connectionpool.py) : https://api.telegram.org:443 "POST /bot***************************************/setWebhook HTTP/1.1" 200 68
2017-12-23 13:57:37,915 [DEBUG] telegram.bot - bot(bot.py) : True
2017-12-23 13:57:37,916 [DEBUG] telegram.bot - bot(bot.py) : Exiting: set_webhook
2017-12-23 13:57:37,925 [DEBUG] telegram.bot - bot(bot.py) : Entering: get_updates
2017-12-23 13:57:38,339 [DEBUG] CTBPlugin.plugins.show_group_id - show_group_id(show_group_id.py) : plugins.show_group_id loading
2017-12-23 13:57:38,340 [DEBUG] CTBMain.command - command(command.py) : Registering new command: show group id(show_tg_group_id)
2017-12-23 13:57:38,341 [DEBUG] CTBMain.command - command(command.py) : show group id(show_tg_group_id) added to global_vars
2017-12-23 13:57:38,341 [DEBUG] CTBMain.command - command(command.py) : Registering new command: show group id(show_qq_group_id)
2017-12-23 13:57:38,342 [DEBUG] CTBMain.command - command(command.py) : show group id(show_qq_group_id) added to global_vars
2017-12-23 13:57:38,343 [DEBUG] CTBPlugin.plugins.for_fun - for_fun(for_fun.py) : plugins.for_fun loading
2017-12-23 13:57:38,344 [DEBUG] CTBMain.command - command(command.py) : Registering new command: dice(dice)
2017-12-23 13:57:38,345 [DEBUG] CTBMain.command - command(command.py) : dice(dice) added to global_vars
2017-12-23 13:57:38,347 [DEBUG] CTBMain.command - command(command.py) : Registering new command: rps(rps)
2017-12-23 13:57:38,348 [DEBUG] CTBMain.command - command(command.py) : rps(rps) added to global_vars
2017-12-23 13:57:38,349 [DEBUG] CTBMain.command - command(command.py) : Registering new command: alipay(show_red_pack)
2017-12-23 13:57:38,350 [DEBUG] CTBMain.command - command(command.py) : alipay(show_red_pack) added to global_vars
2017-12-23 13:57:38,351 [DEBUG] CTBPlugin.plugins.recall - recall(recall.py) : plugins.recall loading
2017-12-23 13:57:38,351 [DEBUG] CTBMain.command - command(command.py) : Registering new command: recall(recall)
2017-12-23 13:57:38,352 [DEBUG] CTBMain.command - command(command.py) : recall(recall) added to global_vars
2017-12-23 13:57:38,360 [DEBUG] CTBPlugin.plugins._002_water_meter_control - _002_water_meter_control(_002_water_meter_control.py) : plugins._002_water_meter_control loading
2017-12-23 13:57:38,361 [DEBUG] CTBPlugin.plugins._002_water_meter_control - _002_water_meter_control(_002_water_meter_control.py) : Begin loading water meter config
2017-12-23 13:57:38,362 [DEBUG] CTBPlugin.plugins._002_water_meter_control - _002_water_meter_control(_002_water_meter_control.py) : plugins._002_water_meter_control loaded
2017-12-23 13:57:38,363 [DEBUG] CTBPlugin.plugins._000_admins - _000_admins(_000_admins.py) : plugins._000_admins loading
2017-12-23 13:57:38,363 [DEBUG] CTBPlugin.plugins._000_admins - _000_admins(_000_admins.py) : Begin loading admin list
2017-12-23 13:57:38,364 [DEBUG] CTBPlugin.plugins._000_admins - _000_admins(_000_admins.py) : plugins._000_admins loaded
2017-12-23 13:57:38,365 [DEBUG] CTBPlugin.plugins._001_group_invite - _001_group_invite(_001_group_invite.py) : plugins._001_group_invite loading
2017-12-23 13:57:38,366 [DEBUG] CTBPlugin.plugins._1001_command - _1001_command(_1001_command.py) : plugins._1001_command loading
2017-12-23 13:57:38,367 [DEBUG] CTBMain.command - command(command.py) : Registering new command: show commands(command_qq)
2017-12-23 13:57:38,367 [DEBUG] CTBMain.command - command(command.py) : show commands(command_qq) added to global_vars
2017-12-23 13:57:38,368 [DEBUG] CTBMain.command - command(command.py) : Registering new command: show commands(command_tg)
2017-12-23 13:57:38,368 [DEBUG] CTBMain.command - command(command.py) : show commands(command_tg) added to global_vars
2017-12-23 13:57:38,374 [DEBUG] CTBMain.command - command(command.py) : Registering new command: help(command_qq)
2017-12-23 13:57:38,375 [DEBUG] CTBMain.command - command(command.py) : help(command_qq) added to global_vars
2017-12-23 13:57:38,376 [DEBUG] CTBMain.command - command(command.py) : Registering new command: help(command_tg)
2017-12-23 13:57:38,378 [DEBUG] CTBMain.command - command(command.py) : help(command_tg) added to global_vars
2017-12-23 13:57:38,380 [DEBUG] CTBPlugin.plugins._1002_filter_old_message - _1002_filter_old_message(_1002_filter_old_message.py) : plugins._1002_filter_old_message loading
2017-12-23 13:57:38,382 [DEBUG] CTBPlugin.plugins._1005_drive_mode - _1005_drive_mode(_1005_drive_mode.py) : plugins._1005_drive_mode loading
2017-12-23 13:57:38,383 [DEBUG] CTBMain.command - command(command.py) : Registering new command: drive mode on(drive_mode_on)
2017-12-23 13:57:38,388 [DEBUG] CTBMain.command - command(command.py) : drive mode on(drive_mode_on) added to global_vars
2017-12-23 13:57:38,394 [DEBUG] CTBMain.command - command(command.py) : Registering new command: drive mode off(drive_mode_off)
2017-12-23 13:57:38,396 [DEBUG] CTBMain.command - command(command.py) : drive mode off(drive_mode_off) added to global_vars
2017-12-23 13:57:38,399 [DEBUG] CTBPlugin.plugins._1006_water_meter_filter - _1006_water_meter_filter(_1006_water_meter_filter.py) : plugins._1006_water_meter_filter loading
2017-12-23 13:57:38,408 [DEBUG] CTBPlugin.plugins._1100_text_forward - _1100_text_forward(_1100_text_forward.py) : plugins._1100_text_forward loading
2017-12-23 13:57:38,410 [DEBUG] CTBMain.command - command(command.py) : Registering new command: image link on(pic_link_on)
2017-12-23 13:57:38,411 [DEBUG] CTBMain.command - command(command.py) : image link on(pic_link_on) added to global_vars
2017-12-23 13:57:38,412 [DEBUG] CTBMain.command - command(command.py) : Registering new command: image link off(pic_link_off)
2017-12-23 13:57:38,413 [DEBUG] CTBMain.command - command(command.py) : image link off(pic_link_off) added to global_vars

环境

  • 是否使用 docker
  • 使用的开发分支

配置文件

bot_constant.json

{
    "DEBUG_MODE": true,
    "BAIDU_API": "",
    "API_ROOT": "http://127.0.0.1:5700/",
    "ACCESS_TOKEN": "very",
    "SECRET": "long",
    "HOST": "127.0.0.1",
    "PORT": 8080,
    "TOKEN": "************************",
    "QQ_BOT_ID": "******",
    "FORWARD_LIST": [
        {
            "QQ": 2333333333,
            "TG": -2333333333333,
            "DRIVE_MODE": false,
            "IMAGE_LINK": true
        },
        {
            "QQ": 23333333,
            "TG": -23333333,
            "DRIVE_MODE": false,
            "IMAGE_LINK": true
        }
    ],
    "SERVER_PIC_URL": "http://expample.com/image/",
    "CQ_ROOT": "/home/user/coolq/",
    "JQ_MODE": true
}

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=very
secret=long
post_message_format=array
serve_data_files=no
update_source=https://raw.githubusercontent.com/richardchien/coolq-http-api-release/master/
update_channel=stable
auto_check_update=no
auto_perform_update=no
thread_pool_size=8
server_thread_pool_size=4

QQ无法转发到TG

排查了好久还是决定来发个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

无法转发(我这个菜鸡实在搞不懂……(暴风哭泣

症状描述

两边都无法转发,酷q机器人正常,debug日志可以看到tg消息,但是提示Connection aborted. ?

-使用docker构建 https://github.com/Z4HD/coolq-telegram-bot-docker
-使用的稳定版
-酷q日志中显示已启用http-api

python3 daemon.py run 的执行输出

2017-12-25 11:23:31,526 [INFO] CTBMain - daemon(daemon.py) : Now running in debug mode...
2017-12-25 11:23:31,528 [DEBUG] telegram.ext.dispatcher - dispatcher(dispatcher.py) : Setting singleton dispatcher as <telegram.ext.dispatcher.Dispatcher object at 0x7f8749c8bcf8>
2017-12-25 11:23:31,529 [DEBUG] telegram.ext.updater - updater(updater.py) : dispatcher - started
2017-12-25 11:23:31,530 [DEBUG] telegram.ext.updater - updater(updater.py) : updater - started
2017-12-25 11:23:31,530 [DEBUG] telegram.ext.updater - updater(updater.py) : Updater thread started
2017-12-25 11:23:31,531 [DEBUG] telegram.bot - bot(bot.py) : Entering: set_webhook
2017-12-25 11:23:31,532 [DEBUG] telegram.vendor.ptb_urllib3.urllib3.connectionpool - connectionpool(connectionpool.py) : Starting new HTTPS connection (1): api.telegram.org
Bottle v0.12.13 server starting up (using WSGIRefServer())...
2017-12-25 11:23:31,533 [DEBUG] CTBPlugin.plugins.qq_namelist - qq_namelist(qq_namelist.py) : plugins.qq_namelist loading
2017-12-25 11:23:31,534 [DEBUG] CTBMain.command - command(command.py) : Registering new command: update namelist(update_namelist)
2017-12-25 11:23:31,534 [DEBUG] CTBMain.command - command(command.py) : update namelist(update_namelist) added to global_vars
Listening on http://127.0.0.1:8080/
Hit Ctrl-C to quit.

2017-12-25 11:23:31,549 [DEBUG] telegram.ext.dispatcher - dispatcher(dispatcher.py) : Dispatcher started
2017-12-25 11:23:32,245 [DEBUG] telegram.vendor.ptb_urllib3.urllib3.connectionpool - connectionpool(connectionpool.py) : https://api.telegram.org:443 "POST /bot495582135:AAES4-9APp7Mdo3KC5MYXrdJ2GzW8mHpxA8/setWebhook HTTP/1.1" 200 68
2017-12-25 11:23:32,245 [DEBUG] telegram.bot - bot(bot.py) : True
2017-12-25 11:23:32,246 [DEBUG] telegram.bot - bot(bot.py) : Exiting: set_webhook
2017-12-25 11:23:32,246 [DEBUG] telegram.bot - bot(bot.py) : Entering: get_updates
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 387, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 383, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib/python3.6/http/client.py", line 1331, in getresponse
    response.begin()
  File "/usr/lib/python3.6/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.6/http/client.py", line 266, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
http.client.RemoteDisconnected: Remote end closed connection without response

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/requests/adapters.py", line 440, in send
    timeout=timeout
  File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 639, in urlopen
    _stacktrace=sys.exc_info()[2])
  File "/usr/local/lib/python3.6/dist-packages/urllib3/util/retry.py", line 357, in increment
    raise six.reraise(type(error), error, _stacktrace)
  File "/usr/local/lib/python3.6/dist-packages/urllib3/packages/six.py", line 685, in reraise
    raise value.with_traceback(tb)
  File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 601, in urlopen
    chunked=chunked)
  File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 387, in _make_request
    six.raise_from(e, None)
  File "<string>", line 2, in raise_from
  File "/usr/local/lib/python3.6/dist-packages/urllib3/connectionpool.py", line 383, in _make_request
    httplib_response = conn.getresponse()
  File "/usr/lib/python3.6/http/client.py", line 1331, in getresponse
    response.begin()
  File "/usr/lib/python3.6/http/client.py", line 297, in begin
    version, status, reason = self._read_status()
  File "/usr/lib/python3.6/http/client.py", line 266, in _read_status
    raise RemoteDisconnected("Remote end closed connection without"
urllib3.exceptions.ProtocolError: ('Connection aborted.', RemoteDisconnected('Remote end closed connection without response',))

配置文件

bot_constant.json

{
    "DEBUG_MODE": true,
    "BAIDU_API": "",
    "API_ROOT": "http://127.0.01:5700/",
    "ACCESS_TOKEN": "very",
    "SECRET": "long",
    "HOST": "127.0.0.1",
    "PORT": 8080,
    "TOKEN": "**************",
    "QQ_BOT_ID": "*********",
    "FORWARD_LIST": [
        {
            "QQ": *********群号,
            "TG": *********,
            "DRIVE_MODE": false,
            "IMAGE_LINK": true
        }
    ],
    "SERVER_PIC_URL": "http://expample.com/image/",
    "CQ_ROOT": "/home/user/coolq/",
    "JQ_MODE": false
}

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://自己的ip:8080/
access_token=very
secret=long
post_message_format=array
serve_data_files=no
update_source=https://raw.githubusercontent.com/richardchien/coolq-http-api-release/master/
update_channel=stable
auto_check_update=no
auto_perform_update=no
thread_pool_size=4
server_thread_pool_size=1

Unable to retrieve group card

Due to updates in coolq platform, cqsocketsdk and this repo require updates.

Update: issue located, cqsocketapi cannot retrieve grouplist

转发至qq失效

telegram发送消息至telegram-bot的时候产生了日志,但是qq-bot并没有反应
并且qq发送消息至qq-bot时没有日志产生,telegram-bot也没有反应。

使用docker构建
https://github.com/Z4HD/coolq-telegram-bot-docker/blob/master/README.md
按照这个步骤来的
json格式会产生错误。所以使用了py格式
容器内文件结构

root@0cf65405cb44:/home/user/coolq-telegram-bot# ls
Architecture.md  bot.log       cqhttp     global_vars.py  LICENSE  message.db  __pycache__  README-zh_CN.md   sample.json
bot_constant.py  ChangeLog.md  daemon.py  image           main     plugins     README.md    requirements.txt  tools

bot_constant.py内容

root@0cf65405cb44:/home/user/coolq-telegram-bot# cat bot_constant.py 
# -*- 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 = 'access_token'  # should be the same as cq-http-api config
SECRET = 'secret '  # 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 = '42144xxx:xxxxxxxxxxxxxxxxxxxx'
QQ_BOT_ID = 'xxxxxx'
FORWARD_LIST = [
]
SERVER_PIC_URL = 'http://expample.com/image/'
CQ_ROOT = '/home/user/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 = ''

python3 daemon.py run跑起来没有报错

root@0cf65405cb44:/home/user/coolq-telegram-bot# python3 daemon.py run
[CTBMain][INFO] (daemon.py:148): Now running in debug mode...
[telegram.ext.dispatcher][DEBUG] (dispatcher.py:131): Setting singleton dispatcher as <telegram.ext.dispatcher.Dispatcher object at 0x7f20c8196080>
[JobQueue][DEBUG] (jobqueue.py:309): 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:276): Updater thread started
[telegram.bot][DEBUG] (bot.py:59): Entering: set_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
Bottle v0.12.13 server starting up (using WSGIRefServer())...
Listening on http://127.0.0.1:8080/
Hit Ctrl-C to quit.

[CTBMain][INFO] (daemon.py:108): Coolq-http-api status: ok
[CTBMain][INFO] (daemon.py:111): Coolq air detected
[CTBPlugin.plugins.qq_namelist][DEBUG] (qq_namelist.py:11): plugins.qq_namelist loading
[CTBMain.main.command][DEBUG] (command.py:55): Registering new command: update namelist(update_namelist)
[CTBMain.main.command][DEBUG] (command.py:73): update namelist(update_namelist) added to global_vars
[CTBPlugin.plugins.show_group_id][DEBUG] (show_group_id.py:13): plugins.show_group_id loading
[CTBMain.main.command][DEBUG] (command.py:55): Registering new command: show group id(show_tg_group_id)
[CTBMain.main.command][DEBUG] (command.py:73): show group id(show_tg_group_id) added to global_vars
[CTBMain.main.command][DEBUG] (command.py:55): Registering new command: show group id(show_qq_group_id)
[CTBMain.main.command][DEBUG] (command.py:73): show group id(show_qq_group_id) added to global_vars
[CTBPlugin.plugins.for_fun][DEBUG] (for_fun.py:9): plugins.for_fun loading
[CTBMain.main.command][DEBUG] (command.py:55): Registering new command: dice(dice)
[CTBMain.main.command][DEBUG] (command.py:73): dice(dice) added to global_vars
[CTBMain.main.command][DEBUG] (command.py:55): Registering new command: rps(rps)
[CTBMain.main.command][DEBUG] (command.py:73): rps(rps) added to global_vars
[CTBMain.main.command][DEBUG] (command.py:55): Registering new command: alipay(show_red_pack)
[CTBMain.main.command][DEBUG] (command.py:73): alipay(show_red_pack) added to global_vars
[CTBPlugin.plugins.recall][DEBUG] (recall.py:10): plugins.recall loading
[CTBMain.main.command][DEBUG] (command.py:55): Registering new command: recall(recall)
[CTBMain.main.command][DEBUG] (command.py:73): recall(recall) added to global_vars
[CTBPlugin.plugins._002_water_meter_control][DEBUG] (_002_water_meter_control.py:12): plugins._002_water_meter_control loading
[CTBPlugin.plugins._002_water_meter_control][DEBUG] (_002_water_meter_control.py:19): Begin loading water meter config
[CTBPlugin.plugins._002_water_meter_control][DEBUG] (_002_water_meter_control.py:116): plugins._002_water_meter_control loaded
[CTBPlugin.plugins._000_admins][DEBUG] (_000_admins.py:12): plugins._000_admins loading
[CTBPlugin.plugins._000_admins][DEBUG] (_000_admins.py:19): Begin loading admin list
[CTBPlugin.plugins._000_admins][DEBUG] (_000_admins.py:93): plugins._000_admins loaded
[CTBPlugin.plugins._001_group_invite][DEBUG] (_001_group_invite.py:13): plugins._001_group_invite loading
[CTBPlugin.plugins._1002_command][DEBUG] (_1002_command.py:12): plugins._1002_command loading
[CTBMain.main.command][DEBUG] (command.py:55): Registering new command: show commands(command_qq)
[CTBMain.main.command][DEBUG] (command.py:73): show commands(command_qq) added to global_vars
[CTBMain.main.command][DEBUG] (command.py:55): Registering new command: show commands(command_tg)
[CTBMain.main.command][DEBUG] (command.py:73): show commands(command_tg) added to global_vars
[CTBMain.main.command][DEBUG] (command.py:55): Registering new command: help(command_qq)
[CTBMain.main.command][DEBUG] (command.py:73): help(command_qq) added to global_vars
[CTBMain.main.command][DEBUG] (command.py:55): Registering new command: help(command_tg)
[CTBMain.main.command][DEBUG] (command.py:73): help(command_tg) added to global_vars
[CTBPlugin.plugins._1001_filter_old_message][DEBUG] (_1001_filter_old_message.py:12): plugins._1001_filter_old_message loading
[CTBPlugin.plugins._1005_drive_mode][DEBUG] (_1005_drive_mode.py:13): plugins._1005_drive_mode loading
[CTBMain.main.command][DEBUG] (command.py:55): Registering new command: drive mode on(drive_mode_on)
[CTBMain.main.command][DEBUG] (command.py:73): drive mode on(drive_mode_on) added to global_vars
[CTBMain.main.command][DEBUG] (command.py:55): Registering new command: drive mode off(drive_mode_off)
[CTBMain.main.command][DEBUG] (command.py:73): drive mode off(drive_mode_off) added to global_vars
[CTBPlugin.plugins._1006_water_meter_filter][DEBUG] (_1006_water_meter_filter.py:11): plugins._1006_water_meter_filter loading
[CTBPlugin.plugins._1100_text_forward][DEBUG] (_1100_text_forward.py:23): plugins._1100_text_forward loading
[CTBMain.main.command][DEBUG] (command.py:55): Registering new command: image link on(pic_link_on)
[CTBMain.main.command][DEBUG] (command.py:73): image link on(pic_link_on) added to global_vars
[CTBMain.main.command][DEBUG] (command.py:55): Registering new command: image link off(pic_link_off)
[CTBMain.main.command][DEBUG] (command.py:73): image link off(pic_link_off) added to global_vars
[CTBPlugin.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 /bot421442752:AAGrcaZSjNmmfa7cOxVaCv5lAo66l1_q6js/setWebhook HTTP/1.1" 200 68
[telegram.bot][DEBUG] (bot.py:61): True
[telegram.bot][DEBUG] (bot.py:62): Exiting: set_webhook
[telegram.bot][DEBUG] (bot.py:59): Entering: get_updates

telegram上对bot发送消息时,日志中有显示,但是QQ中无反应

[telegram.ext.dispatcher][DEBUG] (dispatcher.py:227): Processing Update: {'update_id': 848917101, 'message': {'message_id': 207, 'date': 1523250724, 'chat': {'id': 221184198, 'type': 'private', 'username': 'kasora_san', 'first_name': 'kasora'}, 'text': 'hi', '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': 221184198, 'first_name': 'kasora', 'is_bot': False, 'username': 'kasora_san', 'language_code': 'zh-Hans-CN'}, 'new_chat_member': None}}
[telegram.ext.conversationhandler][DEBUG] (conversationhandler.py:247): selecting conversation (221184198, 221184198) 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

qq发送时日志没有动静,tg也没有收到消息。
访问主机的9000端口输入密码后可以看到已登录的wine-qq的界面。

任何思路或者建议都很有价值。感谢

debian 7 wheezy下同时转发多个群聊出现unhandled exception

在FORWARD_LIST中按如下方式添加了三个群的转发:

FORWARD_LIST = [
    {'QQ': *****3978,
     'TG': -2*****106,
     'DRIVE_MODE': False,
     'IMAGE_LINK': True},
    {'QQ': *****7300,
     'TG': -2*****139,
     'DRIVE_MODE': False,
     'IMAGE_LINK': True},
    {'QQ': 5*****399,
     'TG': -31*****01,
     'DRIVE_MODE': False,
     'IMAGE_LINK': True} 
]

尝试启动的时候会出现以下错误:

[CTB.root][ERROR] (daemon.py:51): Unhandled exception: Traceback (most recent call last):
  File "daemon.py", line 158, in <module>
    main()
  File "daemon.py", line 154, in main
    daemon.run()
  File "daemon.py", line 120, in run
    import plugins  # load all plugins
  File "/root/ForapheQQbot/coolq-telegram-bot/plugins/__init__.py", line 1, in <module>
    import plugins.qq_namelist
  File "/root/ForapheQQbot/coolq-telegram-bot/plugins/qq_namelist.py", line 52, in <module>
    reload_all_qq_namelist()
  File "/root/ForapheQQbot/coolq-telegram-bot/plugins/qq_namelist.py", line 22, in reload_all_qq_namelist
    reload_qq_namelist(i)
  File "/root/ForapheQQbot/coolq-telegram-bot/plugins/qq_namelist.py", line 17, in reload_qq_namelist
    global_vars.group_members[forward_index] = global_vars.qq_bot.get_group_member_list(group_id=FORWARD_LIST[forward_index]['QQ'])
  File "/root/ForapheQQbot/coolq-telegram-bot/cqhttp/__init__.py", line 41, in __call__
    raise Error(resp.status_code, data.get('retcode'))
cqhttp.Error: (200, 102)

此时bot仍然能够收到tg端发送的指令,并且转发也不进行,即使使用了!!update namelist也无效
看样子是qq_namelist读取的循环出现问题。

OS: Linux Debian 7 x64 (wheezy)
Wine 3.0.2
CoolQ Air
Xrdp
Python 3.6.3

同时在ctrl+c强制结束的时候也会出现不同的提示

Exception ignored in: <module 'threading' from '/usr/local/lib/python3.6/threading.py'>
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/threading.py", line 1294, in _shutdown
    t.join()
  File "/usr/local/lib/python3.6/threading.py", line 1056, in join
    self._wait_for_tstate_lock()
  File "/usr/local/lib/python3.6/threading.py", line 1072, in _wait_for_tstate_lock
    elif lock.acquire(block, timeout):
KeyboardInterrupt

不知道是什么问题,是FORWARD_LIST的错误还是代码issue?搜寻网络没有得到有用的结果。

只转发一个群聊的时候可以正常使用,两边的转发和日志都很正常。

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

使用的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

谢谢~

Telegram 群组中发送的图片不能被转发到 QQ 群

如题,在 Telegram 群组中发送图片时,Python 抛出这个异常:

Traceback (most recent call last):
  File "C:\Python\lib\site-packages\telegram\ext\dispatcher.py", line 279, in process_update
    handler.handle_update(update, self)
  File "C:\Python\lib\site-packages\telegram\ext\messagehandler.py", line 169, in handle_update
    return self.callback(dispatcher.bot, update, **optional_args)
  File "C:\coolq-telegram-bot-master\plugins\_1100_text_forward.py", line 57, in photo_from_telegram
    filename = tg_get_file(file_id)
  File "C:\coolq-telegram-bot-master\main\tg_utils.py", line 92, in tg_get_file
    os.rename(filename, new_name_full)
PermissionError: [WinError 32] The process cannot access the file because it is being used by another process: 'C:\\CoolQ\\data/image\\AgADBQADLagxG2vkgFf6_eD8yFAxj16t1jIABKinO5HSwJ7T_CUEAAEC' -> 'C:\\CoolQ\\data/image\\AgADBQADLagxG2vkgFf6_eD8yFAxj16t1jIABKinO5HSwJ7T_CUEAAEC.jpg'

但是 Telegram 群组中发送的 Sticker 是可以被正常转发到 QQ 群的。
系统是 Windows Server 2016,Python 版本为 3.6.6

是否只能通过将bot塞入Docker中才能正常连接至Socket API?

#4 中提到下面这段话:

是这样的,那个cqsocketapi只监听了127.0.0.1,所以bot推荐放到docker里运行

加上本人在Docker中进行了11235端口的映射,但映射出的端口不接受外部连接,bot亦无法从Docker外部连接至Socket API。

是否意味着只有把bot塞进Docker中才能正常连接至Socket API?

tg到qq: 无法转发群组中机器人发的消息channel_post

  • 1.症状描述:

tg到qq,可以正常转发用户发的消息,但是不能转发机器人发的消息

  • 2.python输出

`
[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 /bot77777777:XXXXXXXXXXXXXXXXXXXXXXXX
bot.log
XXXXX/getUpdates HTTP/1.1" 200 250

[telegram.bot][DEBUG] (bot.py:1771):
Getting updates: [288726736]

[telegram.bot][DEBUG] (bot.py:61):
[<telegram.update.Update object at 0x7ff41cf44a90>]

[telegram.bot][DEBUG] (bot.py:62):
Exiting: get_updates

[telegram.ext.dispatcher][DEBUG] (dispatcher.py:227):
Processing Update: {'update_id': 288726736, 'channel_post': {'message_id': 49, 'date': 1572941744, 'chat': {'id': -1001179299168, 'type': 'channel', 'title': '测试频道', 'username': 'Cesaryuan_test_channel1'}, 'text': '测试消息', '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}}

[telegram.ext.dispatcher][DEBUG] (dispatcher.py:284):
Stopping further handlers due to DispatcherHandlerStop

[telegram.bot][DEBUG] (bot.py:59):
Entering: get_updates
`

  • 3.部署方式

docker

  • 4.开发分支

这个不是很懂,就是昨天下载的

图片转发失败。。。感觉coolq图片的API 好像改变了

[telegram.bot][DEBUG] (bot.py:61): True
[telegram.bot][DEBUG] (bot.py:62): Exiting: set_webhook
[telegram.bot][DEBUG] (bot.py:59): Entering: get_updates
[CTBMain.utils][DEBUG] (utils.py:458): qq -> tg: [{'data': {'file': '39F2F3683FD4DD4A448DA4684C313ACF.jpg', 'url': 'https://gchat.qpic.cn/gchatpic_new/1203120914/701311009-2792625372-39F2F3683FD4DD4A448DA4684C313ACF/0?vuin=2776926981&term=2'}, 'type': 'image'}]
Traceback (most recent call last):
  File "/usr/local/lib/python3.6/dist-packages/bottle.py", line 862, in _handle
    return route.call(**args)
  File "/usr/local/lib/python3.6/dist-packages/bottle.py", line 1740, in wrapper
    rv = callback(*a, **ka)
  File "/home/user/coolq-telegram-bot/cqhttp/__init__.py", line 118, in _handle
    result = handler(request.json)
  File "/home/user/coolq-telegram-bot/cqhttp/__init__.py", line 63, in wrapper
    return func(*args, **kwargs)
  File "/home/user/coolq-telegram-bot/plugins/_1100_text_forward.py", line 571, in handle_forward
    qq_user=context['user_id'])
  File "/home/user/coolq-telegram-bot/utils.py", line 483, in send_from_qq_to_tg
    cq_get_pic_url(filename)
  File "/home/user/coolq-telegram-bot/cq_utils.py", line 184, in cq_get_pic_url
    url = parser['image']['url']
  File "/usr/lib/python3.6/configparser.py", line 959, in __getitem__
    raise KeyError(key)
KeyError: 'image'
127.0.0.1 - - [25/Mar/2018 13:52:24] "POST / HTTP/1.1" 500 741

建议加个单向模式

我们需要将QQ群的信息自动转发到TG群,但TG群中的消息不自动转发至QQ群
在TG群中的消息只有带上//前缀才会被发送至QQ群

阔以的话可以在群设置中加个布尔选项

双边无法传输图片

控制台输出

TG转发至QQ

coolq@hostname:~/coolq-telegram-bot$ 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 0x7f0f622089e8>
[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 pro 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): [qq_group_id]Try to update qq namelist
[CTB.plugins.qq_namelist][INFO] (qq_namelist.py:32): [qq_group_id]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: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 /bottg_bot_token/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 /bottg_bot_token/getUpdates HTTP/1.1" 200 545
[telegram.bot][DEBUG] (bot.py:1771): Getting updates: [539026705]
[telegram.bot][DEBUG] (bot.py:61): [<telegram.update.Update object at 0x7f0f5c1832b0>]
[telegram.bot][DEBUG] (bot.py:62): Exiting: get_updates
[telegram.ext.dispatcher][DEBUG] (dispatcher.py:227): Processing Update: {'update_id': 539026705, 'message': {'message_id': 149, 'date': 1550063465, 'chat': {'id': tg_group_id, 'type': 'supergroup', 'title': 'tg_group_name'}, 'entities': [], 'caption_entities': [], 'photo': [{'file_id': 'AgADBQAD_agxG9eJIFcq_zRBEZLumVfk3zIABOdvu4ukfpuH23QBAAEC', 'width': 85, 'height': 90, 'file_size': 1802}, {'file_id': 'AgADBQAD_agxG9eJIFcq_zRBEZLumVfk3zIABALUz8KqmJ2t2nQBAAEC', 'width': 112, 'height': 118, 'file_size': 4653}], 'new_chat_members': [], 'new_chat_photo': [], 'delete_chat_photo': False, 'group_chat_created': False, 'supergroup_chat_created': False, 'channel_chat_created': False, 'from': {'id': tg_user_id, 'first_name': '\u2060', 'is_bot': False, 'last_name': 'tg_user_name', 'username': 'tg_username', 'language_code': 'zh-hans'}}}
[telegram.ext.conversationhandler][DEBUG] (conversationhandler.py:257): selecting conversation (tg_group_id, tg_user_id) with state None
[CTB.main.utils][DEBUG] (utils.py:240): tg -> qq: [{'type': 'image', 'data': {'file': 'AgADBQAD_agxG9eJIFcq_zRBEZLumVfk3zIABALUz8KqmJ2t2nQBAAEC.jpg'}}]
[CTB.main.message_persistence][DEBUG] (message_persistence.py:39): append tg_msg_id:149, qq_msg_id:73, qq_num:0, time:1550063466 to _0
[telegram.bot][DEBUG] (bot.py:59): Entering: get_updates

QQ转发至TG

[CTB.main.utils][DEBUG] (utils.py:454): qq -> tg: [{'data': {'file': '621F6B932516F22B06C3448152E18A18.jpg', 'url': 'image_url'}, 'type': 'image'}]
Traceback (most recent call last):
  File "/home/coolq/.local/lib/python3.6/site-packages/bottle.py", line 862, in _handle
    return route.call(**args)
  File "/home/coolq/.local/lib/python3.6/site-packages/bottle.py", line 1740, in wrapper
    rv = callback(*a, **ka)
  File "/home/coolq/coolq-telegram-bot/cqhttp/__init__.py", line 147, in _handle
    result = handler(request.json)
  File "/home/coolq/coolq-telegram-bot/cqhttp/__init__.py", line 79, in wrapper
    return func(*args, **kwargs)
  File "/home/coolq/coolq-telegram-bot/plugins/_1100_text_forward.py", line 414, in handle_forward
    qq_user=context['user_id'])
  File "/home/coolq/coolq-telegram-bot/main/utils.py", line 479, in send_from_qq_to_tg
    result = cq_get_fileid(message_part)
  File "/home/coolq/coolq-telegram-bot/main/cq_utils.py", line 187, in cq_get_fileid
    file_id = global_vars.fdb.get_fileid_by_md5(parser['image']['md5'])
  File "/usr/lib/python3.6/configparser.py", line 959, in __getitem__
    raise KeyError(key)
KeyError: 'image'
127.0.0.1 - - [13/Feb/2019 20:49:44] "POST / HTTP/1.1" 500 741

部署方式

手动部署

配置文件

bot_constant.py

# -*- 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 = 'token'  # should be the same as cq-http-api config
SECRET = 'secret'  # 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 = 'tg_bot_token'
QQ_BOT_ID = 'qq_user_id'
FORWARD_LIST = [
    {'QQ': qq_group_id,
     'TG': tg_group_id,
     'DRIVE_MODE': False,
     'IMAGE_LINK': False}
]
USE_SHORT_URL = False
SERVER_PIC_URL = 'http://expample.com/image/'
CQ_ROOT = '/home/coolq/coolq-telegram-bot/cqp-data/'
JQ_MODE = True
CQ_ROOT_DIR = '/home/coolq/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 = ''

coolq_httpapi.json

{
    "host": "127.0.0.1",
    "port": 5700,
    "use_http": true,
    "ws_host": "127.0.0.1",
    "ws_port": 6700,
    "use_ws": false,
    "ws_reverse_url": "",
    "ws_reverse_api_url": "",
    "ws_reverse_event_url": "",
    "ws_reverse_reconnect_interval": 3000,
    "ws_reverse_reconnect_on_code_1000": true,
    "use_ws_reverse": false,
    "post_url": "http://127.0.0.1:8080",
    "access_token": "token",
    "secret": "secret",
    "post_message_format": "array",
    "serve_data_files": false,
    "update_source": "github",
    "update_channel": "stable",
    "auto_check_update": false,
    "auto_perform_update": false,
    "show_log_console": false,
    "log_level": "info"
}

问题

双边无法传输图片
TG的图片转发到QQ,从输出中找不到明显的报错,QQ这边直接显示TG的用户名和一个冒号,无图片
QQ的图片转发到TG,直接报错
从issues中找不到可以参考的(

QQ能到TG,TG不能到QQ

QQ能到TG,TG不能到QQ
部署在Windows上
master分支
bot.log
输出如下:

PS C:\Users\Administrator> cd C:\telegramBot
PS C:\telegramBot> python daemon.py run
[CTB.Main][DEBUG] (daemon.py:153): Now running in debug mode...
[telegram.ext.dispatcher][DEBUG] (dispatcher.py:131): Setting singleton dispatcher as <telegram.ext.dispatcher.Dispatche
r object at 0x000001C8046D4AC8>
[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.dispatcher][DEBUG] (dispatcher.py:209): Dispatcher started
[telegram.ext.updater][DEBUG]Bottle v0.12.13 server starting up (using WSGIRefServer())...
Listening on http://127.0.0.1:8080/
 (updater.py:308): Hit Ctrl-C to quit.

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
[CTB.Main][INFO] (daemon.py:115): Coolq-http-api status: ok
[CTB.Main][INFO] (daemon.py:118): Coolq pro detected
[CTB.plugins.qq_namelist][DEBUG] (qq_namelist.py:11): 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.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

在docker环境下程序运行后无法转发

按照docker教程稳定版部署完成后启动,httpapi插件确定启动,并在酷q日志可以看到启动服务,但什么都没有发生。。
在日志内可以看到telegram的消息和qq的http post,但在任何一边发送!!cmd均无反应。
以下是BOT日志:

2017-12-26 11:50:40,743 [DEBUG] CTBPlugin.plugins.qq_namelist - qq_namelist(qq_namelist.py) : plugins.qq_namelist loading
2017-12-26 11:50:40,744 [DEBUG] CTBMain.command - command(command.py) : Registering new command: update namelist(update_namelist)
2017-12-26 11:50:40,744 [DEBUG] CTBMain.command - command(command.py) : Registering new command: update namelist(update_namelist)
2017-12-26 11:50:40,744 [DEBUG] CTBMain.command - command(command.py) : update namelist(update_namelist) added to global_vars
2017-12-26 11:50:40,744 [DEBUG] CTBMain.command - command(command.py) : update namelist(update_namelist) added to global_vars
2017-12-26 20:32:41,429 [DEBUG] CTBPlugin.plugins.qq_namelist - qq_namelist(qq_namelist.py) : plugins.qq_namelist loading
2017-12-26 20:32:41,430 [DEBUG] CTBMain.command - command(command.py) : Registering new command: update namelist(update_namelist)
2017-12-26 20:32:41,430 [DEBUG] CTBMain.command - command(command.py) : Registering new command: update namelist(update_namelist)
2017-12-26 20:32:41,431 [DEBUG] CTBMain.command - command(command.py) : update namelist(update_namelist) added to global_vars
2017-12-26 20:32:41,431 [DEBUG] CTBMain.command - command(command.py) : update namelist(update_namelist) added to global_vars
2017-12-26 20:33:15,858 [INFO] CTBMain - daemon(daemon.py) : Now running in debug mode...
2017-12-26 20:33:15,858 [INFO] CTBMain - daemon(daemon.py) : Now running in debug mode...
2017-12-26 20:33:15,860 [DEBUG] telegram.ext.dispatcher - dispatcher(dispatcher.py) : Setting singleton dispatcher as <telegram.ext.dispatcher.Dispatcher object at 0x7f3ab8a79be0>
2017-12-26 20:33:15,861 [DEBUG] JobQueue - jobqueue(jobqueue.py) : JobQueue thread started
2017-12-26 20:33:15,861 [DEBUG] telegram.ext.updater - updater(updater.py) : dispatcher - started
2017-12-26 20:33:15,862 [DEBUG] telegram.ext.updater - updater(updater.py) : updater - started
2017-12-26 20:33:15,862 [DEBUG] telegram.ext.updater - updater(updater.py) : Updater thread started
2017-12-26 20:33:15,862 [DEBUG] telegram.bot - bot(bot.py) : Entering: set_webhook
2017-12-26 20:33:15,863 [DEBUG] telegram.vendor.ptb_urllib3.urllib3.connectionpool - connectionpool(connectionpool.py) : Starting new HTTPS connection (1): api.telegram.org
2017-12-26 20:33:15,869 [DEBUG] CTBPlugin.plugins.qq_namelist - qq_namelist(qq_namelist.py) : plugins.qq_namelist loading
2017-12-26 20:33:15,869 [DEBUG] CTBMain.command - command(command.py) : Registering new command: update namelist(update_namelist)
2017-12-26 20:33:15,869 [DEBUG] CTBMain.command - command(command.py) : Registering new command: update namelist(update_namelist)
2017-12-26 20:33:15,870 [DEBUG] CTBMain.command - command(command.py) : update namelist(update_namelist) added to global_vars
2017-12-26 20:33:15,870 [DEBUG] CTBMain.command - command(command.py) : update namelist(update_namelist) added to global_vars
2017-12-26 20:33:15,871 [DEBUG] telegram.ext.dispatcher - dispatcher(dispatcher.py) : Dispatcher started
2017-12-26 20:33:16,863 [DEBUG] telegram.vendor.ptb_urllib3.urllib3.connectionpool - connectionpool(connectionpool.py) : https://api.telegram.org:443 "POST /bot501074420:AAHLR7o0Nf4DsR695V-mhrZRvlX2xV4aQu8/setWebhook HTTP/1.1" 200 68
2017-12-26 20:33:16,865 [DEBUG] telegram.bot - bot(bot.py) : True
2017-12-26 20:33:16,865 [DEBUG] telegram.bot - bot(bot.py) : Exiting: set_webhook
2017-12-26 20:33:16,865 [DEBUG] telegram.bot - bot(bot.py) : Entering: get_updates
2017-12-26 20:33:44,810 [DEBUG] telegram.vendor.ptb_urllib3.urllib3.connectionpool - connectionpool(connectionpool.py) : https://api.telegram.org:443 "POST /bot501074420:AAHLR7o0Nf4DsR695V-mhrZRvlX2xV4aQu8/getUpdates HTTP/1.1" 200 297
2017-12-26 20:33:44,811 [DEBUG] telegram.bot - bot(bot.py) : Getting updates: [750024706]
2017-12-26 20:33:44,812 [DEBUG] telegram.bot - bot(bot.py) : [<telegram.update.Update object at 0x7f3ab5d42978>]
2017-12-26 20:33:44,812 [DEBUG] telegram.bot - bot(bot.py) : Exiting: get_updates
2017-12-26 20:33:44,813 [DEBUG] telegram.ext.dispatcher - dispatcher(dispatcher.py) : Processing Update: {'update_id': 750024706, 'message': {'message_id': 738, 'date': 1514320424, 'chat': {'id': -1001113906641, 'type': 'supergroup', 'title': 'KOGSC', 'username': 'KOGSC'}, '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': 329676427, 'first_name': 'HYX5020', 'is_bot': False, 'username': 'hyx5020', 'language_code': 'en'}, 'new_chat_member': None}}
2017-12-26 20:33:45,813 [DEBUG] telegram.bot - bot(bot.py) : Entering: get_updates
2017-12-26 20:33:51,071 [DEBUG] telegram.vendor.ptb_urllib3.urllib3.connectionpool - connectionpool(connectionpool.py) : https://api.telegram.org:443 "POST /bot501074420:AAHLR7o0Nf4DsR695V-mhrZRvlX2xV4aQu8/getUpdates HTTP/1.1" 200 307
2017-12-26 20:33:51,072 [DEBUG] telegram.bot - bot(bot.py) : Getting updates: [750024707]
2017-12-26 20:33:51,073 [DEBUG] telegram.bot - bot(bot.py) : [<telegram.update.Update object at 0x7f3ab5d42b70>]
2017-12-26 20:33:51,073 [DEBUG] telegram.bot - bot(bot.py) : Exiting: get_updates
2017-12-26 20:33:51,074 [DEBUG] telegram.ext.dispatcher - dispatcher(dispatcher.py) : Processing Update: {'update_id': 750024707, 'message': {'message_id': 739, 'date': 1514320430, 'chat': {'id': -1001113906641, 'type': 'supergroup', 'title': 'KOGSC', 'username': 'KOGSC'}, 'text': 'HYX5020:\n!!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': 329676427, 'first_name': 'HYX5020', 'is_bot': False, 'username': 'hyx5020', 'language_code': 'en'}, 'new_chat_member': None}}
2017-12-26 20:33:52,074 [DEBUG] telegram.bot - bot(bot.py) : Entering: get_updates
2017-12-26 20:34:42,324 [DEBUG] telegram.vendor.ptb_urllib3.urllib3.connectionpool - connectionpool(connectionpool.py) : https://api.telegram.org:443 "POST /bot501074420:AAHLR7o0Nf4DsR695V-mhrZRvlX2xV4aQu8/getUpdates HTTP/1.1" 200 23
2017-12-26 20:34:42,326 [DEBUG] telegram.bot - bot(bot.py) : No new updates found.
2017-12-26 20:34:42,326 [DEBUG] telegram.bot - bot(bot.py) : []
2017-12-26 20:34:42,327 [DEBUG] telegram.bot - bot(bot.py) : Exiting: get_updates
2017-12-26 20:34:43,328 [DEBUG] telegram.bot - bot(bot.py) : Entering: get_updates
2017-12-26 20:35:33,580 [DEBUG] telegram.vendor.ptb_urllib3.urllib3.connectionpool - connectionpool(connectionpool.py) : https://api.telegram.org:443 "POST /bot501074420:AAHLR7o0Nf4DsR695V-mhrZRvlX2xV4aQu8/getUpdates HTTP/1.1" 200 23
2017-12-26 20:35:33,582 [DEBUG] telegram.bot - bot(bot.py) : No new updates found.
2017-12-26 20:35:33,583 [DEBUG] telegram.bot - bot(bot.py) : []
2017-12-26 20:35:33,583 [DEBUG] telegram.bot - bot(bot.py) : Exiting: get_updates
2017-12-26 20:35:34,585 [DEBUG] telegram.bot - bot(bot.py) : Entering: get_updates
2017-12-26 20:36:24,834 [DEBUG] telegram.vendor.ptb_urllib3.urllib3.connectionpool - connectionpool(connectionpool.py) : https://api.telegram.org:443 "POST /bot501074420:AAHLR7o0Nf4DsR695V-mhrZRvlX2xV4aQu8/getUpdates HTTP/1.1" 200 23
2017-12-26 20:36:24,836 [DEBUG] telegram.bot - bot(bot.py) : No new updates found.
2017-12-26 20:36:24,836 [DEBUG] telegram.bot - bot(bot.py) : []
2017-12-26 20:36:24,836 [DEBUG] telegram.bot - bot(bot.py) : Exiting: get_updates
2017-12-26 20:36:25,837 [DEBUG] telegram.bot - bot(bot.py) : Entering: get_updates
2017-12-26 20:37:43,738 [INFO] CTBMain - daemon(daemon.py) : Now running in debug mode...
2017-12-26 20:37:43,738 [INFO] CTBMain - daemon(daemon.py) : Now running in debug mode...
2017-12-26 20:37:43,740 [DEBUG] telegram.ext.dispatcher - dispatcher(dispatcher.py) : Setting singleton dispatcher as <telegram.ext.dispatcher.Dispatcher object at 0x7f3c3da8bbe0>
2017-12-26 20:37:43,741 [DEBUG] JobQueue - jobqueue(jobqueue.py) : JobQueue thread started
2017-12-26 20:37:43,742 [DEBUG] telegram.ext.updater - updater(updater.py) : dispatcher - started
2017-12-26 20:37:43,742 [DEBUG] telegram.ext.updater - updater(updater.py) : updater - started
2017-12-26 20:37:43,743 [DEBUG] telegram.ext.updater - updater(updater.py) : Updater thread started
2017-12-26 20:37:43,743 [DEBUG] telegram.bot - bot(bot.py) : Entering: set_webhook
2017-12-26 20:37:43,743 [DEBUG] telegram.vendor.ptb_urllib3.urllib3.connectionpool - connectionpool(connectionpool.py) : Starting new HTTPS connection (1): api.telegram.org
2017-12-26 20:37:43,750 [DEBUG] CTBPlugin.plugins.qq_namelist - qq_namelist(qq_namelist.py) : plugins.qq_namelist loading
2017-12-26 20:37:43,750 [DEBUG] CTBMain.command - command(command.py) : Registering new command: update namelist(update_namelist)
2017-12-26 20:37:43,750 [DEBUG] CTBMain.command - command(command.py) : Registering new command: update namelist(update_namelist)
2017-12-26 20:37:43,750 [DEBUG] CTBMain.command - command(command.py) : update namelist(update_namelist) added to global_vars
2017-12-26 20:37:43,750 [DEBUG] CTBMain.command - command(command.py) : update namelist(update_namelist) added to global_vars
2017-12-26 20:37:43,751 [DEBUG] telegram.ext.dispatcher - dispatcher(dispatcher.py) : Dispatcher started
2017-12-26 20:37:45,157 [DEBUG] telegram.vendor.ptb_urllib3.urllib3.connectionpool - connectionpool(connectionpool.py) : https://api.telegram.org:443 "POST /bot501074420:AAHLR7o0Nf4DsR695V-mhrZRvlX2xV4aQu8/setWebhook HTTP/1.1" 200 68
2017-12-26 20:37:45,159 [DEBUG] telegram.bot - bot(bot.py) : True
2017-12-26 20:37:45,160 [DEBUG] telegram.bot - bot(bot.py) : Exiting: set_webhook
2017-12-26 20:37:45,160 [DEBUG] telegram.bot - bot(bot.py) : Entering: get_updates
2017-12-26 20:38:09,280 [DEBUG] telegram.vendor.ptb_urllib3.urllib3.connectionpool - connectionpool(connectionpool.py) : https://api.telegram.org:443 "POST /bot501074420:AAHLR7o0Nf4DsR695V-mhrZRvlX2xV4aQu8/getUpdates HTTP/1.1" 200 297
2017-12-26 20:38:09,281 [DEBUG] telegram.bot - bot(bot.py) : Getting updates: [750024708]
2017-12-26 20:38:09,281 [DEBUG] telegram.bot - bot(bot.py) : [<telegram.update.Update object at 0x7f3c3c556978>]
2017-12-26 20:38:09,281 [DEBUG] telegram.bot - bot(bot.py) : Exiting: get_updates
2017-12-26 20:38:09,282 [DEBUG] telegram.ext.dispatcher - dispatcher(dispatcher.py) : Processing Update: {'update_id': 750024708, 'message': {'message_id': 740, 'date': 1514320688, 'chat': {'id': -1001113906641, 'type': 'supergroup', 'title': 'KOGSC', 'username': 'KOGSC'}, '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': 329676427, 'first_name': 'HYX5020', 'is_bot': False, 'username': 'hyx5020', 'language_code': 'en'}, 'new_chat_member': None}}
2017-12-26 20:38:10,282 [DEBUG] telegram.bot - bot(bot.py) : Entering: get_updates
2017-12-26 20:38:15,436 [DEBUG] telegram.vendor.ptb_urllib3.urllib3.connectionpool - connectionpool(connectionpool.py) : https://api.telegram.org:443 "POST /bot501074420:AAHLR7o0Nf4DsR695V-mhrZRvlX2xV4aQu8/getUpdates HTTP/1.1" 200 304
2017-12-26 20:38:15,436 [DEBUG] telegram.bot - bot(bot.py) : Getting updates: [750024709]
2017-12-26 20:38:15,437 [DEBUG] telegram.bot - bot(bot.py) : [<telegram.update.Update object at 0x7f3c3c556b70>]
2017-12-26 20:38:15,437 [DEBUG] telegram.bot - bot(bot.py) : Exiting: get_updates
2017-12-26 20:38:15,437 [DEBUG] telegram.ext.dispatcher - dispatcher(dispatcher.py) : Processing Update: {'update_id': 750024709, 'message': {'message_id': 741, 'date': 1514320695, 'chat': {'id': -1001113906641, 'type': 'supergroup', 'title': 'KOGSC', 'username': 'KOGSC'}, 'text': '心累', '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': 329676427, 'first_name': 'HYX5020', 'is_bot': False, 'username': 'hyx5020', 'language_code': 'en'}, 'new_chat_member': None}}
2017-12-26 20:38:16,438 [DEBUG] telegram.bot - bot(bot.py) : Entering: get_updates
2017-12-26 20:39:06,794 [DEBUG] telegram.vendor.ptb_urllib3.urllib3.connectionpool - connectionpool(connectionpool.py) : https://api.telegram.org:443 "POST /bot501074420:AAHLR7o0Nf4DsR695V-mhrZRvlX2xV4aQu8/getUpdates HTTP/1.1" 200 23
2017-12-26 20:39:06,795 [DEBUG] telegram.bot - bot(bot.py) : No new updates found.
2017-12-26 20:39:06,796 [DEBUG] telegram.bot - bot(bot.py) : []
2017-12-26 20:39:06,796 [DEBUG] telegram.bot - bot(bot.py) : Exiting: get_updates
2017-12-26 20:39:07,797 [DEBUG] telegram.bot - bot(bot.py) : Entering: get_updates
2017-12-26 20:39:58,150 [DEBUG] telegram.vendor.ptb_urllib3.urllib3.connectionpool - connectionpool(connectionpool.py) : https://api.telegram.org:443 "POST /bot501074420:AAHLR7o0Nf4DsR695V-mhrZRvlX2xV4aQu8/getUpdates HTTP/1.1" 200 23
2017-12-26 20:39:58,152 [DEBUG] telegram.bot - bot(bot.py) : No new updates found.
2017-12-26 20:39:58,152 [DEBUG] telegram.bot - bot(bot.py) : []
2017-12-26 20:39:58,152 [DEBUG] telegram.bot - bot(bot.py) : Exiting: get_updates
2017-12-26 20:39:59,153 [DEBUG] telegram.bot - bot(bot.py) : Entering: get_updates
2017-12-26 20:40:49,518 [DEBUG] telegram.vendor.ptb_urllib3.urllib3.connectionpool - connectionpool(connectionpool.py) : https://api.telegram.org:443 "POST /bot501074420:AAHLR7o0Nf4DsR695V-mhrZRvlX2xV4aQu8/getUpdates HTTP/1.1" 200 23
2017-12-26 20:40:49,520 [DEBUG] telegram.bot - bot(bot.py) : No new updates found.
2017-12-26 20:40:49,520 [DEBUG] telegram.bot - bot(bot.py) : []
2017-12-26 20:40:49,520 [DEBUG] telegram.bot - bot(bot.py) : Exiting: get_updates
2017-12-26 20:40:50,522 [DEBUG] telegram.bot - bot(bot.py) : Entering: get_updates

以下是bot_constant.json/bot_constant.py/酷Qhttp cfg文件设置

bot_constant.json

{
    "DEBUG_MODE": true,
    "BAIDU_API": "",
    "API_ROOT": "http://127.0.0.1:5700/",
    "ACCESS_TOKEN": "very",
    "SECRET": "long",
    "HOST": "127.0.0.1",
    "PORT": 8080,
    "TOKEN": "***********************************************************",
    "QQ_BOT_ID": "************",
    "FORWARD_LIST": [
        {
            "DISCUSS": *******,
            "TG": -*************,
            "DRIVE_MODE": false,
            "IMAGE_LINK": true
        },
    ],
    "SERVER_PIC_URL": "http://**.**.***.**/image/",
    "CQ_ROOT": "/home/user/coolq",
    "JQ_MODE": false
}

bot_constant.py

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

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

BAIDU_API = ''

# 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 = 'very'  # should be the same as cq-http-api config
SECRET = 'long'  # 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 = '**********************************************************'
QQ_BOT_ID = '***********'
FORWARD_LIST = [
    {'DISCUSS': *******,
     'TG': -****************,
     'DRIVE_MODE': False,
     'IMAGE_LINK': True},
]
SERVER_PIC_URL = 'http://**.**.***.**/image/'
CQ_ROOT = '/home/user/coolq'
JQ_MODE = False  # If you are using CoolQ AIr, change to False

酷Qhttp 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=very
secret=long
post_message_format=array
serve_data_files=no
update_source=https://raw.githubusercontent.com/richardchien/coolq-http-api-release/master/
update_channel=stable
auto_check_update=no
auto_perform_update=no
thread_pool_size=4
server_thread_pool_size=1

关键信息已做处理,确认正确。

关键词的功能如何使用

Hi
我看到changelog里面有一条

关键词触发改为单条不转发,而不是开启驾驶模式

请问这个关键词要如何设置?
Ps:这个功能可不可以设置为触发关键词才转发,比如 hi siri xxxx,触发siri关键字转发这条消息

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.