Alternative Project: coolq-telegram-bot-x
coolq-telegram-bot-x is written in C++ and is still under construction, but it needs no Python environment at all. The difference is that THIS REPO is on the fast ring, and it intends for feature developments, and coolq-telegram-bot-x intends for higher performance, but until now it has fewer features.
Telegram:
QQ:
》》中文 Readme《《
QQ & Telegram Relay Bot v3.4 € QQ API based on CoolQ HTTP API,Telegram API based on python_telegram_bot
- Fix Stickers forward issue
- Dockerfile: add libwebp
- *** License changed to MIT ***
- Dockerfile:use Alpine image
- Dockerfile:fixed ffmpeg installation
- Cache Management(partial):use MD5 to identify file,send fileid instead of whole file
- Code classification, optimization for recall and “//”
- keyword filter changed to not forwarding single message, instead of enabling drive mode
- drive mode now modifies title of groups
View More(Chinese)
- Support text forward between QQ and Telegram
- Images from QQ will be forwarded to Telegram, but Telegram images will be forwarded via links
- Telegram stickers will be converted to emojis, with the link if enabled IMAGE_LINK_MODE
- Some QQ emojis will be converted to Unicode emojis
- Support temporarily disable forwarding
- Support commands, use
!!show commands
or!!cmd
to list
- Support text forward between QQ and Telegram
- Images will be forwarded to opposite sides
- Some QQ emojis will be converted to Unicode emojis
- Support commands, use
!!show commands
or!!cmd
to list
Now support docker-compose, more details (Chinese)
Only want to run Coolq in a container? These images below here may useful.
- coolq/wine-coolq Official Coolq Docker
- richardchien/cqhttp richardchien's Coolq Docker, with Coolq http api
Please follow the instruction of the one you chose, and jump to Configuration part of this instruction
If you don't prefer Docker, follow this instruction (Please use Ubuntu, since bugs appear on Debian 9)
【简单教程】在 DigitalOcean 的 Ubuntu Server 下运行 酷Q Air apt-get install libcurl4-openssl-dev libssl-dev ffmpeg
- Typical Coolq http api config (
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_channel=stable
auto_check_update=no
auto_perform_update=no
Since Coolq Air doesn't support sending images, Telegram images will be sent via the link. You need to expose these images for access.
Install nginx under Ubuntu
sudo apt-get install nginx
edit nginx/conf/nginx.conf,this config maps /home/coolq/coolq/data/image
to www.example.com:8080/image
server {
listen 8080;
server_name www.example.com;
location /image/ {
root /home/coolq/coolq/data;
}
}
pip3.6 install -r requirements.txt
Key | Example | Introduction |
---|---|---|
TOKEN |
Telegram tot token | |
QQ_BOT_ID |
QQ bot number | |
FORWARD_LIST |
A list that defines forwards. Every dict in this list [QQ Group Number, Telegran Group ID,Default for DRIVE_MODE, Default for IMAGE_LINK_MODE] stands for a forward. Only one to one forward is supported. |
|
SERVER_PIC_URL |
Your server's domain(used for url access, if you are using Pro, you can set whatever you like since it is not used) | |
CQ_ROOT_DIR |
Coolq's root directory | |
API_ROOT |
http://127.0.0.1:5700/ |
cq-http-api's API root |
ACCESS_TOKEN |
cq-http-api's access_token, see cq-http-api's doc for further information | |
SECRET |
cq-http-api's secret, see cq-http-api's doc for further information | |
HOST |
127.0.0.1 |
cq-http-api's event report address |
PORT |
8080 |
cq-http-api's event report port |
DEBUG_MODE |
true |
Debug mode. Set to True is encouraged. Since rotate log handler is used, it will take up no more than 3MB. |
PROXY_URL |
None |
Connects to the specified Socks5 proxy address and does not use proxy when the value is empty or False .(optional in JSON, the default is None ) |
USE_SHORT_URL |
true |
Use short links, it is recommended to open. (optional in JSON, the default is true ) |
Please rename bot_constant-sample.py
to bot_constant.py
before use.
Key - Value peer is the same as above
If you want to use JSON, please copy or soft-link bot_constant-json.py
to bot_constant.py
ln -s bot_constant-json.py bot_constant.py
if you want to load external settings file, use CTB_JSON_SETTINGS_PATH
Example:
export CTB_JSON_SETTINGS_PATH="/home/user/bot_constant.json"
tools/bot_constant-py2json.py
provides convertion from bot_constant.py
to bot_constant.json
Make sure that you have finished all configure steps.
python3.6 daemon.py -h
Currently daemon mode has been implemented, using the following instructions to run in the background.
- Start background service
python3.6 daemon.py start
- Stop the background service
python3.6 daemon.py stop
If you need to see the log output in real time, close the running daemon first. Then follow this command.
python3.6 daemon.py run
Send !!show commands
or !!cmd
to view all commands
Send !!alipay
of !!ali
,to acquire. This action will donate the author without costing your money
Send !!show group id
or !!id
in Telegram groups to view Telegram Group ID
Send !!update namelist
or !!name
to update qq name list manually
Enable: Send !!pic link on
or !!lnkon
Disable: Send !!pic link off
or !!lnkoff
Telegram images and stickers will forward to QQ via links after enabled this
Enable:Send !!drive mode on
or !!drive
Disable:Send !!drive mode off
or !!park
The forward function will be disabled temporarily after enabled this
Reply !!recall
or !!del
in Telegram to any message you want to recall in QQ.
The message must be sent by the bot in QQ side.
** If the message exceeds 2 minutes, the recall will fail**
Currently, QQ group invites and accept invites is available via private chat.
You can find out the usage by reading plugins/_00x_xxxxx.py
- Check if you are using Python 3.6+
- Check if requirements.txt is installed correctly
- Check if cq-http-api is enabled in Coolq
- Descriptions about the issue
- Logs of python3 daemon.py run (Desensitization)
- Whether you are using Docker
- Which branch you are on (Dev of Master)