繞過登錄限制,wechaty免費版web協議實現微信機器人


驚喜!!!放在前面

在我發布文章這一天,下午打開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 onScan(qrcode, status) {
  Qrterminal.generate(qrcode); // 在console端顯示二維碼
  const qrcodeImageUrl = [
    "https://wechaty.js.org/qrcode/",
    encodeURIComponent(qrcode),
  ].join("");
  console.log(qrcodeImageUrl);
}

// 登錄
async function onLogin(user) {
  console.log(`貼心小助理${user}登錄了`);
  if (config.AUTOREPLY) {
    console.log(`已開啟機器人自動聊天模式`);
  }
}

//登出
function onLogout(user) {
  console.log(`小助手${user} 已經登出`);
}

bot.on("scan", onScan);
bot.on("login", onLogin);
bot.on("logout", onLogout);
bot.on("message", function(message){
    console.log(message);
}) // 消息監聽
bot
  .start()
  .then(() => console.log("開始登陸微信"))
  .catch((e) => console.error(e));

微信圖片_20210414142032.png


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM