Through the enterprise WeChat robot, random color pictures are regularly pushed to the enterprise WeChat group. Three formats will be pushed at one time, News
Text
Image
(because Enterprise WeChat has a blocking function, which may cause some pictures pushed in News
format to be unable to be opened, so the latter two are added. At the same time, Text
can be set to @ everyone)
Use docker to quickly build a color map service with basic functions.
# 省略git和docker的安装过程,建议使用apt或yum快速解决
git clone https://github.com/zhangyu0310/wechat-setu-bot.git
cd wechat-setu-bot
docker build -t centos:setubot .
# 在 WECHAT_WEBHOOK="" 的双引号里,填入企业微信机器人的webhook
docker run --name setu -e WECHAT_WEBHOOK= " " -d centos:setubot
or
# 无需要git,不拉源码,直接下载docker镜像
docker pull zhangyu0310/centos:setubot
# 在 WECHAT_WEBHOOK="" 的双引号里,填入企业微信机器人的webhook
docker run --name setu -e WECHAT_WEBHOOK="" -d centos:setubot
The first method is relatively traffic-saving, and docker build is completed locally. The second method seems simpler, but it requires pulling the image and consumes a certain amount of traffic.
Deployment using docker only provides the most basic functions, without capabilities such as image dumping and message forwarding. Complex functions need to be configured according to the parameter description below.
. s etuServer.exe -at-all -dl-dir= " ./pic " -pic-msg -wechat-url= " xxx " -intervals=3600 -r18
parameter | illustrate | Remark |
---|---|---|
-at-all | Having this option will bring @everyone | bool type |
-dl-dir | Specify the path to download images | Only takes effect when -pic-msg is specified |
-dump-server | Image dump server information | ip:port |
-dump-url | Image dump domain name | Push dump image Url of Text format message |
-help | help | |
-intervals | Color image push interval (unit: seconds) | The default is 60, the minimum is 10 (don’t screw up other people’s pornographic service!) |
-keep | Keep local original image | Pushing Image message requires downloading the image. This parameter indicates whether to retain the image. Default is true |
-news-msg | Whether to push News messages | bool type, default is true |
-once | Exit immediately after performing a push | Separate the timing logic and use external timing mechanisms such as crontab to achieve more flexible control. |
-pic-dump | Whether to enable image dumping | bool type |
-pic-msg | Whether to push Image messages | bool type, the specific reason for this parameter is as follows |
-pic-size | Pictures can be downloaded in different sizes | Default is original |
-r18 | I understand everything | bool type |
-setu-api-url | Colormap API Url | Default is https://api.lolicon.app/setu/v1 |
-setu-transmit | messaging | Pass all messages to the dump service for broadcast distribution, as detailed below |
-tags | Image tags | You can specify to push a certain image with a certain tag |
-transmit-server | Messaging target server | ip:port |
-version | Print version | |
-wechat-url | WeChat robot webhook address | Required |
-wechat-url
to start the service -pic-msg
parameter Enterprise WeChat will block News
messages from some websites. In order to see whether it is a picture you like before clicking on the link, Image
messages are pushed here.
Image
messages need to download the image to the local first (so you need to specify the download path of the -dl-dir
image)
Since Enterprise WeChat requires that the image size cannot exceed 2M, the size of the downloaded image has been adjusted. What you see in the group is probably not the original picture.
Since pixiv and its proxy services are often blocked, the output domain names often cannot be opened. Therefore, the dump function is provided, and the service can be deployed on the server outside the wall and then dumped to the server inside the wall. This function requires the dump receiving module in the wall to be used together.
EasyPicServer
If you don't want to push to only one webhook, you can forward the message to EasyPicServer and let it broadcast it on your behalf. It has implemented a simple webhook registration page, out of the box. Why not just use this service broadcast? In order to save cross-border server traffic costs. . .
THX Lolicon API
May our future shine brightly!