惊喜!!!放在前面
在我发布文章这一天,下午打开wechaty博客的时候发现
重磅:绕过登录限制,wechaty免费版web协议重新荣光
这篇文章,可以完美实现无需token即可实现微信登录
效果及代码
你的微信会在桌面微信登录,完美绕过不可以web登录微信的痛点,也可以正常使用你的其他功能
const { Wechaty } = require"wechaty");
const Qrterminal = require"qrcode-terminal");
const name = "wechat-puppet-wechat";
let bot = "";
bot = new Wechaty{
name, // generate xxxx.memory-card.json and save login data for the next login
});
// 二维码生成
function onScanqrcode, status) {
Qrterminal.generateqrcode); // 在console端显示二维码
const qrcodeImageUrl = [
"https://wechaty.js.org/qrcode/",
encodeURIComponentqrcode),
].join"");
console.logqrcodeImageUrl);
}
// 登录
async function onLoginuser) {
console.log`贴心小助理${user}登录了`);
if config.AUTOREPLY) {
console.log`已开启机器人自动聊天模式`);
}
}
//登出
function onLogoutuser) {
console.log`小助手${user} 已经登出`);
}
bot.on"scan", onScan);
bot.on"login", onLogin);
bot.on"logout", onLogout);
bot.on"message", functionmessage){
console.logmessage);
}) // 消息监听
bot
.start)
.then) => console.log"开始登陆微信"))
.catche) => console.errore));
愿以往所学皆有所获

