This repository has been archived by the owner on Aug 4, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
run_test.sh
executable file
·72 lines (60 loc) · 2.25 KB
/
run_test.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
# 用户设置
tg_telegram_id=404348187
qq_id=1195129533
# 密码设置
tg_group_token=525674017:AAF7HPnA_d-SZbg_Q3BKOF3y5GQ9CkDhcUA
tg_friend_token=531873229:AAH3vEBkpMEtdJgxuYNIWOhO8_ofSaW_n6A
vnc_passwd=fK32lrGf
qq_access_token=Mgep4rV49rM8Jf
qq_secret=kP9yK2lrGxoymmpo
# 代理设置
use_proxy=True # True or False
proxy_url=socks5h://host.docker.internal:1080
ip() {
docker inspect --format '{{ .NetworkSettings.IPAddress }}' $1
}
cool_bot_ip=172.17.0.2
# 启动 Telegram 机器人
echo init Telegram bot
tg_container_id=$(docker run -d --rm --name forward-test \
-e TG_TELEGRAM_ID=$tg_telegram_id \
-e TG_ENABLE_PROXY=$use_proxy \
-e TG_PROXY_URL=$proxy_url \
-e TG_GROUP_TOKEN=$tg_group_token \
-e TG_FRIEND_TOKEN=$tg_friend_token \
-e QQ_ACCESS_TOKEN=$qq_access_token \
-e QQ_SECRET=$qq_secret \
-e QQ_API_ROOT=http://$cool_bot_ip:5700/ \
-e QQ_POST_HOST=0.0.0.0 \
-e QQ_POST_PORT=8080 \
oymiss/forward-bot:beta)
forward_bot_ip=$(ip $tg_container_id)
# 启动 CoolQ
echo start CoolQ bot
qq_container_id=$(docker run -di --rm --name cqhttp-test \
-v ~/coolq:/home/user/coolq \
-p 9000:9000 \
-e FORCE_ENV=true \
-e COOLQ_ACCOUNT=$qq_id \
-e CQHTTP_POST_URL=http://$forward_bot_ip:8080 \
-e CQHTTP_SERVE_DATA_FILES=yes \
-e CQHTTP_SECRET=$qq_secret \
-e CQHTTP_ACCESS_TOKEN=$qq_access_token \
-e CQHTTP_POST_MESSAGE_FORMAT=array \
-e VNC_PASSWD=$vnc_passwd \
richardchien/cqhttp:4.12.0)
cool_bot_ip=$(ip $qq_container_id)
echo restart Telegram bot
docker stop $tg_container_id
tg_container_id=$(docker run -d --rm --name forward-test \
-e TG_TELEGRAM_ID=$tg_telegram_id \
-e TG_ENABLE_PROXY=$use_proxy \
-e TG_PROXY_URL=$proxy_url \
-e TG_GROUP_TOKEN=$tg_group_token \
-e TG_FRIEND_TOKEN=$tg_friend_token \
-e QQ_ACCESS_TOKEN=$qq_access_token \
-e QQ_SECRET=$qq_secret \
-e QQ_API_ROOT=http://$cool_bot_ip:5700/ \
-e QQ_POST_HOST=0.0.0.0 \
-e QQ_POST_PORT=8080 \
oymiss/forward-bot:beta)