当前位置: 首页 > 后端技术 > Node.js

Wechaty初探

时间:2023-04-04 01:16:09 Node.js

本文是python-wechaty+wechaty-puppet-padlocal初探注意事项wechaty-puppet-padlocal目前只能使用国内公网IP。新注册的微信小号将无法登录。测试日期:2021-03-01环境:本地手机(iPad或手机均可)PC(本文使用Mac)阿里云puppet架构的虚拟机。在虚拟机上运行wechaty-puppet,验证API是否注册。成功运行本地python-wechaty-getting-started扫描二维码登录第一步【wechaty-puppet-padlocal】你需要国内公网IP+Token(请向管理员注册)使wechaty-puppet生效虚拟机部分可以选择阿里云或者freeplan华为云或者GCP可惜谷歌没有国内IP,不然你也可以玩玩gcp的k8s。推荐大家使用国内资源注册ubuntu20.04。Notethatthesecuritygroupmustallowport8788torunintheubuntucmdline已下指令aptupdateaptinstalldocker.iodockerpullwechaty/wechatyexportWECHATY_PUPPET_PADLOCAL_TOKEN=puppet_padlocal_xxxxxxxxxxxxxxxxxxexportWECHATY_PUPPET_SERVER_PORT=8788exportWECHATY_PUPPET=wechaty-puppet-padlocalexportWECHATY_LOG=verbosedockerrun--rm-ti-eWECHATY_LOG-eWECHATY_PUPPET-eWECHATY_HOSTIE_PORT-eWECHATY_TOKEN-p"$WECHATY_HOSTIE_PORT"wechaty/wechaty3.可以下命令查看是否运行正常,如图netstat-ntlpdockercontainerls4。可以telnet虚拟机IP:8788方便调试是否连接5.(可选)你可以运行把dockerrun改成docker-compose,虚拟机崩溃后可以自动长大。Step2[Verifyhostietoken]访问https://api.chatie.io/v0/host...查看你的token是否注册成功,如果没有,请返回step1查看Good:{"ip":"47.119.129.29","port":8788}NoGood:{"ip":"0.0.0.0","port":0}步骤3[在本地运行python]python-wechaty-getting-started你需要Python3。7+运行以下cmdgit克隆https://github.com/wechaty/python-wechaty-getting-startedcdpython-wechaty-getting-startedpip3install-rrequirements.txtexportWECHATY_PUPPET=wechaty-puppet-serviceexportWECHATY_PUPPET_SERVICE_TOKEN=your_token_at_herepython3examples/ding-dong-bot.py等二维码出现扫码即可第4步【微信扫码】目前新注册的账号扫码后会登录失败最后邀请好友或者发给自己(无空格,全小写)自动回复dong!以后官网上会有很多资源和应用,大家有时间可以浏览一下。快乐黑客!

最新推荐
猜你喜欢