Projects
This article introduces the project is to use node and wechaty wechat web interface development of a small tool that can be timed to send the daily weather conditions to his girlfriend, weather reminders, a sentence a day. By configuring the robot api can also be realized after wechat robot automatically accompany the girlfriend to chat.
Project Address
github
Effect Preview
Before the three-step instruction, let's put up the effect and see it
You can see that you will receive messages sent at the specified time, including weather information, weather reminders, and how many days you have been together. When the robot is turned on, the girlfriend can talk to the little assistant, but the current open source robot api are not very intelligent, matching the semantics may not be so accurate. So sometimes when your girlfriend is angry, you must remember not to turn on the robot!
This project is used in the early stage of the Turing robot, but recently the Turing robot to do the restrictions, no authenticated users are not allowed to call the API, authenticated users only 100 entries per day, which is very chicken, the girlfriend has not been coaxed through the addiction it is limited, which is very scary (manual comical)! So now replace a day line robot api interface, this interface does not have too many restrictions, sent the number of calls is also enough to use, in the project has been open to everyone to use, but it is still recommended that you apply for an account is better, because this robot can be customized name and so on, you can also set up their own need to reply to the content.
Three-step tutorial
I. Installation of node
node official website
Select the system corresponding to the version of node download and install, win recommended .msi package installation, just keep on the next step can be, other systems are the same;
Once the installation is complete, hold down shift + right mouse button on your keyboard and select Open command window here. Execute node -v at the command line and the version number will appear, indicating that the installation was successful.
Second, download the code and configure
code address
Visit this address to download the zip package directly to your local desktop and unzip it;
Go into the directory and find the file in the config directory
Select the file, right-click to select the open mode, no code editor can be installed with Notepad to open. Have a code editor directly with the code editor to open, suggest that non-developers can download a notepad + +, developers on their own to play it, I believe that everyone has their own use of a more comfortable editor I do not recommend!
Configuration file needs to be modified in the place, girlfriend's WeChat note name NAME must be changed, or you send me is not good 😂, WeChat nickname NICKNAME is best to also write, you and your girlfriend's anniversary MEMORIAL_DAY needless to say, also need to change.
If you want to send weather information, your girlfriend's city CITY must also be modified, and if you don't know how to spell regional LOCATION, I suggest that you can look up the inkedofficial website
After finding the weather of the corresponding region in Mobil Weather, check the address bar of the webpage, and fill in CITY for the pinyin marked in green, and LOCATION for the pinyin marked in red.
The time of day to send SENDDATE, the rules here can be found in the file in the schedule directory. Here 0 06 8 * * * * represents the daily 8:06:0 in the morning, we usually only need to configure the first three can be.
If you need to open the robot chat, you need to set AUTOREPLY to true, here I gave up the Turing robot, the reason is also said above, changed to use the Tianxing robot, but don't hold too much hope, it's not so smart 😂. At present, due to my own account api times are still relatively large, in the project code is open to everyone to use, here will not be released, download the code as long as you modify the AUTOREPLY can automatically reply.
// Configuration files = { // Configuration items for the basic timed delivery function (required) NAME: 'Leo_chen', //Girlfriend Remarks Name NICKNAME: 'Leo_chen', //Girlfriend nicknames MEMORIAL_DAY: '2015/04/18', // Your anniversary with your girlfriend CITY: 'shanghai', //Girlfriend's city LOCATION: "pudong-new-district", //Girlfriend's district (you can check the English spelling of the district after visiting the InkWeather website) SENDDATE: '0 06 8 * * *', //Timed send time Send at 8:0:0 every day, see /schedule/ for rules. ONE: '/', Web version of ////ONE MOJI_HOST: '/weather/china/', //China Ink Weather url //Advanced Function Configuration Items (not required) AUTOREPLY: true, //Auto Chat feature off by default AIBOTAPI: '/txapi/robot/', // Skywalker Robotics API Registration Address/?source=474284281 APIKEY: 'Skywalker Robotics apikey', //Skywalker Robotics apikey }
III. Start running the program
Don't forget to save the configuration file and go back to the project's home directory. At this point, if you are a Win system, hold down the shift + right mouse button on your keyboard and select Open Command Window Here.
Then type npm install.
Wait for the installation to complete and enter npm run start, this time it will download a file, because it is relatively large, so we have to wait a little longer, waiting for the appearance of the QR code when you can take out your cell phone WeChat sweep to log in. Next is a meal of God dialog 😆
If npm run start fails, run npm install wechaty-puppet-puppeteer@^0.17.14 --no-save and then npm run start.
Handling of common problems
- First check if the node version is greater than 10
- Existing files are deleted first
- Remove node_modules and re-execute npm install.
I can't log in on my microsignal
From late June 2017, there is a high probability of being restricted from logging in using the web-based version of the WeChat access program. The main performance is: can not log in Web WeChat, but does not affect other platforms such as cell phones. Verify whether you are restricted from logging in: on the scanning code to see whether you can log in, if you can not log in, then you may not be able to use this tool.
Unable to install puppet-puppeteer&&Chromium when running npm run start
The following problem occurs with deployment under Centos 7
Solution.
# Dependencies yum install pango.x86_64 libXcomposite.x86_64 libXcursor.x86_64 libXdamage.x86_64 libXext.x86_64 libXi.x86_64 libXtst.x86_64 cups-libs.x86_64 libXScrnSaver.x86_64 libXrandr.x86_64 GConf2.x86_64 alsa-lib.x86_64 atk.x86_64 gtk3.x86_64 -y #Font yum install ipa-gothic-fonts xorg-x11-fonts-100dpi xorg-x11-fonts-75dpi xorg-x11-utils xorg-x11-fonts-cyrillic xorg-x11-fonts-Type1 xorg-x11-fonts-misc -y
Under, download of puppeteer fails
Do it.npm install wechaty-puppet-puppeteer@^0.17.14 --no-save
take note of
This project belongs to personal interest in the development of open source out of technical exchanges, please do not use this project to do violations of WeChat regulations or other illegal things, please do not commercial. It is recommended to use a small number for testing, there is a risk of being banned from the web-side login privileges by WeChat (the client is not affected), please make sure to use it voluntarily. Please make sure you use it voluntarily. The author has nothing to do with the banning of the web login privileges due to personal misuse, thanks for your understanding!
This is the whole content of this article.