npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

wxbot-puppet-bridge

v1.0.19

Published

Puppet Bridge for WeChat Robots

Downloads

116

Readme

WxBot Puppet Bridge

基于 wechaty 协议的微信机器人桥接服务。

已支持的微信机器人协议:

一、安装

npm install wxbot-puppet-bridge

二、功能列表

没有你想要的功能,可以提 issue 优先处理。

| 功能列表 | 已支持 | | ------------------------------------------ | ------ | | 基础功能(二维码登录、登录回调、消息监听) | ✅ | | 消息体解析(文本、图片、视频、表情、文件、小程序卡片等) | ✅ | | 发消息(文本、图片、文件、视频、联系人、链接、小程序卡片) | ✅ | | 联系人(添加/删除/修改联系人、获取联系人列表、搜索用户等) | ✅ | | 群事件(加入群聊、退出群聊、修改群名称、群邀请) | ✅ | | 群操作(创建/退出/解散群聊、修改群名称、添加/删除群成员、发布群公告、群邀请验证) | ✅ | | 标签管理(标签列表、添加成员标签、移除成员标签、创建标签、删除标签) | ✅ |

适配中:

  • 转发消息(兼容多种消息格式);

三、如何使用

1. bot

iimport { WechatyBuilder, ScanStatus, Message, log, types } from 'wechaty';
import qrTerm from 'qrcode-terminal';
import { FileBox } from 'file-box';
import { WeChatSdkPuppetBridge_3_9_10_19 as PuppetBridge } from 'wxbot-puppet-bridge';
import { jsonStringify, createDir } from 'wxbot-puppet-bridge/dist/shared';

async function main() {
  const puppet = new PuppetBridge({
    apiUrl: 'http://127.0.0.1:8888',
    protocol: 'ws'
  });

  const bot = WechatyBuilder.build({ name: 'wechatsdk-bot', puppet });

  bot.on('scan', onScan);

  bot.on('login', user => {
    log.info('Bot use login: ', jsonStringify(user));
  });

  bot.on('ready', () => {
    log.info('Bot is ready');
  });

  bot.on('message', onMessage);

  bot.on('logout', user => {
    log.info('Bot user logout: ', jsonStringify(user));
  });

  bot.on('error', error => {
    log.error('Bot error:', error.message);
  });

  await bot.start();
}

main()
  .then(() => log.info('StarterBot', 'Ready'))
  .catch(console.error);

2. hack

wechaty puppet 功能会以 puppet[method] 的方式提供,例如:

async function main() {
  const puppet = new PuppetBridge({
    apiUrl: 'http://127.0.0.1:8888',
    protocol: 'ws'
  });
  
  // 1. create tag
  // const tag = await puppet.createTag('test-tag');
  // log.info('Tag created: ', jsonStringify(tag));

  // 2. delete tag
  // await puppet.deleteTag('59');
  // log.info('Tag deleted successfully');

  // 3. get tag members
  // const memberIds = await puppet.getTagMemberList('56');
  // log.info('Tag members: ', jsonStringify(memberIds));

  // 4. get tags of contact
  const tags = await puppet.getTags();
  log.info('Contact tags: ', jsonStringify(tags));
}

三、参考