Personal WeChat (non-public account) WeChat robot can automatically reply to friends’ messages, chat in group chats, check weather, and check garbage classification according to instructions. It is built based on ChatApi-WeChat.
Mainly I want to write a group assistant to use as a tool in the group. Therefore, the information responded by this robot mainly starts with the command prefix. Taking into account the habits of domestic mobile phone input methods, the default command prefix is two question marks, because the pinyin 9-square grid layout question marks are in the shortcut bar, which is convenient for input.
For specific instructions, it is hoped that Chinese characters will be given priority and abbreviations will be given priority.
fastjson
1.2.58 has a major vulnerability and has been upgraded to 1.2.60
One sentence per day uses thread pool scheduling to fix the bug of poor scheduling stability caused by the previous use of Timer
.
Added commands to view daily news and view Zhihu hot lists. New features must be enabled to use redis.
Garbage classification is connected to the AToolBox interface. AToolBox's database is more complete, and there are similar word prompts, but the interface is a bit slow, and Redis must be turned on. If redis cache is not enabled, you can change it back to LAJIFENLEIAPP.
Added Redis cache, which can cache weather query results and garbage classification query results in Redis. If you don't have Redis, you can turn off caching in the configuration file. Turning off the cache will not affect existing functions, but some functions that rely on redis may be updated in the future.
Requirements environment: jdk 1.8+, Maven
The global configuration file is resource/config.properties
.
The cache configuration file is resource/redis.properties
.
Program entry: WechatBot.java
After starting the program, open the QR code link output by the console and scan it using WeChat.
Tip: Any unofficial way to log in to the WeChat web page may result in the account's permission to log in to the WeChat web page being blocked (it does not affect the use of other terminals). It is recommended to use small size.
The default command prefix is two question marks: ??
, both Chinese and English are available. The command prefix + specific command forms a complete command. For example,北京天气
is a weather command, and ??北京天气
is a complete command. When a group member with weather mode authority sends ??北京天气
, this robot will automatically reply with the Beijing weather information for that day.
The directive prefix can be customized in the configuration file.
A. 获取详情 B. 查天气 天气 北京天气 海淀天气 上海天气 深圳天气 C. 查垃圾分类 电池 无汞电池 塑料袋 D. 当日新闻 新闻 E. 知乎热榜 知乎 知乎 1 知乎2
The program monitors the content of the corresponding group chat. When it detects a sentence starting with天气
, it queries the weather of the corresponding city and automatically sends it to the group chat. For example:北京天气
,北京市天气
. Only supports domestic (most) city, district, and county inquiries, and does not support provinces. A small number of areas are not supported due to interface data loss.
If ?
and天气
are detected, today's weather will be sent to the address on the sender's WeChat business card.
完整指令举例: 天气 北京天气 上海天气 海淀天气
Set the configuration file autoReplyFriend
to true
to automatically reply to friend messages. Will not reply to friends on the blacklist.
This feature is only open to whitelisted groups or friends by default. The bot will reply to messages from any whitelisted sender.
Tip: Free robots are artificially retarded, so this function is recommended for testing and entertainment.
When an instruction (with the prefix removed) begins with a question mark ?
/ ?
At the beginning, this command is a query garbage classification command. Enter specific garbage to query the garbage classification. like ???电池
, ???无汞电池
.
完整指令举例: 无汞电池 电池 塑料袋 卫生纸
Enable a daily sentence in the configuration to send the day's weather and famous quotes to the specified group at the specified time. The day's weather uses api.WeatherApi
, and the daily sentence uses api.EveryDayHelloApi
.
If the configured time for the current day has passed, normal execution will begin from the next day.
Sending messages to friends is not enabled yet.
新闻
知乎 知乎 1 知乎 3
Intelligent robot API: https://www.sojson.com/api/semantic.html
Qingyunke Weather API: https://www.sojson.com/api/weather.html
Friendly reminder: Online chat with artificially retarded people, a tool for cold scenes and a breakup master.
RollToolsApi: https://github.com/MZCretin/RollToolsApi
Kingsoft PowerWord: http://open.iciba.com/dsapi/
LAJIFENLEIAPP: http://lajifenleiapp.com/
AToolBox: http://www.atoolbox.net/Tool.php?Id=804
Zhihu Daily: https://news-at.zhihu.com/api/6/news/hot
This project is inseparable from the inspiration of the following projects, and I would like to express my gratitude to the developers:
EverydayWechat
WeChat Assistant: 1. Send customized messages to friends regularly every day. 2. Automatically reply to friends. (Python)
xuxiaoxiao-xxx/ChatApi-WeChat
Java version of WeChat chat interface, using web WeChat API, allows you to develop your own WeChat chat robot
Apache License 2.0