A WeChat robot with simple functions and easy use
Supported functions:
Optional features:
Use preconditions
git clone https://github.com/leantli/wc_robot.git
go mod tidy
config.yaml
-> robot_name
and on_contact_nicknames
go run main.go
env GOOS=linux GOARCH=amd64 go build -o wc_robot main.go
in the project root directorywc_robot
and the configuration file config.yaml
to the server. It depends on you which directory to upload to the server.chmod +x ./wc_robot
gives execution permission to the filenohup ./wc_robot > robot.log &
run the program in the background and output the log to the robot.log
filetail -50f ./robot.log
observe the log. The WeChat login QR code is also in the log. Scan the code to log in by yourself.2022.11.9 TODO(leantli):
weather_msg_handle.city_code
, match the corresponding city area according to other WeChat users' messages for weather broadcast (☑️)2022.11.11 TODO(leantli):
2022.11.28 TODO(leantli):
2022.12.9 TODO(leantli):
2023.2.23: I should not continue to update this project. I will start a new branch to try other ways of WeChat robots. I was laid off recently. Let’s check it out later when I have time.
The following configuration modifications are based on
config.yaml
weather_msg_handle.switch_on
Whether to enable automatic reply for this keyword, the default is true
covid_msg_handle.switch_on
Whether to enable automatic reply for this keyword, the default is true
weather_schedules.switch_on
Whether to enable this scheduled task, the default is false
, enable is set to true
weather_schedules.to_nicknames
Who should the weather forecast be sent to? The filled content is the nickname of the WeChat user. Group chat nicknames are supported. If multiple people need to be filled in, separate them with English commas ','weather_schedules.to_remarknames
Who should the weather forecast be sent to? The filled-in content is the WeChat user's remarks. Group chat remarks are not supported. Group chat remarks are not returned during WeChat normal communication and cannot be recognized. If multiple people need to be filled in, use an English comma ',' separateweather_schedules.times
is the specific time for sending weather forecasts every day, the format is "00:00:00", multiple times are separated by English commas ','weather_schedules.city_code
The area where this weather forecast is broadcast defaults to the Nanshan area of Shenzhen. If you need to change it, see https://wis.qq.com/city/like?source=pc&city=Nanshan, modify the last "Nanshan" by yourself, and search Get the corresponding city_code clock_in_schedules.switch_on
Whether to enable this scheduled task, the default is false
, enable is set to true
clock_in_schedules.to_nicknames
Who to send this message to? Fill in the nickname of the WeChat user. Group chat nicknames are supported. If multiple people need to be filled in, separate them with English commas ','clock_in_schedules.to_remarknames
Who should the message be sent to? The filled-in content is the WeChat user’s remarks. Group chat remarks are not supported. Group chat remarks are not returned during WeChat normal communication and cannot be recognized. If multiple people need to be filled in, separate them with English commas ','clock_in_schedules.times
is the specific time for sending messages regularly every day, the format is "00:00:00", multiple times are separated by English commas ','clock_in_schedules.text
message, such as "I miss my wife so much❤️", "Not getting off work yet?" days_matters.switch_on
Whether to enable this scheduled task, the default is false
, enable is set to true
days_matters.to_nicknames
Who should the reminder be sent to? The filled content should be the nickname of the WeChat user. Group chat nicknames are supported. If multiple people need to be filled in, separate them with English commas ','days_matters.to_remarknames
Who should the reminder be sent to? The filled-in content is the WeChat user’s remarks. Group chat remarks are not supported. Group chat remarks are not returned during WeChat normal communication and cannot be recognized. If multiple people need to be filled in, separate them with English commas ','days_matters.times
is the specific time to send reminders every day, the format is "00:00:00", multiple times are separated by English commas ','days_matters.date
The specific dates of important days, in the format of "yyyy-MM-dd", such as "2021-4-3"days_matters.content
are the important days, such as "Being with my wife", "Paying salary"Take "with my wife" as an example
If date is set to the past time, the message will be sent as "%s (with my wife) has been %d days"
If date is set to the time of the day, the message will be sent as "Today is %s (with my wife)"
If date is set to the future time, the message will be sent as "There are %d days until %s (with my wife)"
alapi.switch_on
Whether to enable automatic reply for this keyword, the default is false
, if enabled, configure it to true
, and pay attention to configuring token
alapi.token
, you need to register on the ALAPI website to obtain it. Free users of the api support 1qps calls, which is more than enough for personal use. openai.api_key
: open_ai’s authentication token, you need to register on the openai official website and obtain it from https://beta.openai.com/account/api-keysopenai.gpt_text_switch_on
Whether to enable GPT text reply function, the default is false
openai.gpt_text_is_default_reply
Whether to set gpt text reply as the default reply (that is, automatically call GPT when other keywords are not triggered), false When closed, the gpt reply needs to be triggered through the "gpt xxx" format; enabled by default