• Stars
    star
    225
  • Rank 177,187 (Top 4 %)
  • Language
    TypeScript
  • License
    Apache License 2.0
  • Created over 6 years ago
  • Updated over 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Puppet Provider Abstraction for Wechaty

wechaty-puppet

Powered by Wechaty NPM Version npm (tag) TypeScript Linux/Mac Build Status ES Modules

chatie puppet

Picture Credit: https://www.shareicon.net

Abstract(Base) Class of Puppet Providers for Wechaty Framework.

This module is part of the Wechaty Framework SDK.

Learn more at:

  1. Wiki: https://github.com/wechaty/wechaty/wiki/Puppet
  2. Issue: wechaty/wechaty#1167

Documentation

Wechaty Puppet Provider Interface Documentation can be found at https://wechaty.github.io/wechaty-puppet/typedoc/classes/puppet.html

Automatica Generated by TypeDoc

Example

PuppetMock: https://github.com/wechaty/wechaty-puppet-mock

The above puppet provider is just for mocking and easy to understand. It will be a good starter when you want to develope a new puppet by yourself for fullfil your need, for example, connect Wechaty with Wechat Official Account.

Providers

Dependencies

  1. FileBox (npm module file-box) MUST be imported from wechaty-puppet because all the Wechaty Framework needs to check instanceof FileBox, we must be sure all FileBox is the same version.
  2. MemoryCard (npm module memory-card) MUST be imported from wechaty-puppet because all the Wechaty Framework needs to check instanceof MemoryCard, we must be sure all MemoryCard is the same version.

Peer Dependence

Puppet(npm module wechaty-puppet) itself must be a peer Dependencies for all the Puppet Providers, and should only be installed via Wechaty because all Puppet Providers should share the same Puppet Base Class with Wechaty, we must be sure all Puppet is the same version.

Wechaty Puppet Toolsets

1. Using SwitchState

You can get to know the puppet start/stop state from the state property:

  1. puppet.state.on() === 'pending' will be true when the puppet is starting
  2. puppet.state.on() === true will be true when the puppet is started
  3. puppet.state.off() === 'pending' will be true when the puppet is stoping
  4. `puppet.state.off() === true' will be true when the puppet is stopped

Learn more about the puppet.state at https://github.com/huan/state-switch

2. Using Brolog

Using Brolog to output necessary log messages.

2.1 Get log from Brolog

import { log } from 'brolog'

2.2 Log Format

log.verbose('ModuleName', 'methodName() Your Verbose Message Here')
log.silly('ModuleName', 'methodName() Your Silly Message Here')

2.3 Log Level

Brolog has five log levels, it should be used and follow the following rules:

Log Level What does it means Usage in Puppet
log.silly() There's some detail debug information Can be used in everywhere as you like
log.verbose() There's some debug information Should be used at the beginning of every method()
log.info() There's something we need to let user know Should NEVER to be used because Puppet is Library
log.warn() There's a Coverable Error Should not be used unless we have to
log.error() There's a Un-covered Error Should not be used unless we have to

3. Using LRU Cache

Set the max size for wechaty entities in LRU Cache.

Env Name What does it means
WECHATY_PUPPET_LRU_CACHE_SIZE_CONTACT The max cache size for contact, default value 3000
WECHATY_PUPPET_LRU_CACHE_SIZE_FRIENDSHIP The max cache size for friendship, default value 100
WECHATY_PUPPET_LRU_CACHE_SIZE_MESSAGE The max cache size for message, default value 500
WECHATY_PUPPET_LRU_CACHE_SIZE_ROOM The max cache size for room, default value 500
WECHATY_PUPPET_LRU_CACHE_SIZE_ROOM_INVITATION The max cache size for room invitation, default value 100
WECHATY_PUPPET_LRU_CACHE_SIZE_ROOM_MEMBER The max cache size for room member, default value 30000

Resources

Pure Function

Mixin

History

master v1.0 - Initial Release

v0.49 (Oct 2021)

  1. Add Error interface to EventErrorPayload, and make .data optional
  2. Using Mixin to extend Puppet

v0.43 (Aug 28, 2021)

  1. Support ES Modules

v0.16 (Sep 2019)

Works with the following Puppet Providers:

  1. wechaty-puppet-puppeteer
  2. wechaty-puppet-padchat
  3. wechaty-puppet-mock
  4. wechaty-puppet-wechat4u

v0.0.1 (Jun 2018)

  1. Define the Abstract Puppet Layer for Wechaty
  2. Seperate code from Wechaty

Author

Huan LI (李卓桓) [email protected]

Profile of Huan LI (李卓桓) on StackOverflow

Copyright & License

  • Code & Docs © 2018-now Huan LI <[email protected]>
  • Code released under the Apache-2.0 License
  • Docs released under Creative Commons

More Repositories

1

wechaty

Conversational RPA SDK for Chatbot Makers. Join our Discord: https://discord.gg/7q8NBZbQzt
TypeScript
19,950
star
2

python-wechaty

Python Wechaty is a Conversational RPA SDK for Chatbot Makers written in Python
Python
1,568
star
3

getting-started

A Starter Project Template for Wechaty works out-of-the-box
JavaScript
781
star
4

puppet-padlocal

Puppet PadLocal is a Pad Protocol for WeChat
TypeScript
619
star
5

go-wechaty

Go Wechaty is a Conversational SDK for Chatbot Makers Written in Go
Go
480
star
6

puppet-xp

Wechaty Puppet WeChat Windows Protocol
JavaScript
449
star
7

java-wechaty

Java Wechaty is a Conversational SDK for Chatbot Makers Written in Kotlin
Kotlin
409
star
8

puppet-wechat

Wechaty Puppet Provider for WeChat
TypeScript
402
star
9

wechaty-puppet-padplus

DEPRECATED: One puppet based on iPad protocal for Wechaty
TypeScript
315
star
10

wechaty-puppet-padchat

Padchat Puppet for Wechaty
TypeScript
281
star
11

wechaty-puppet-padpro

TypeScript
238
star
12

python-wechaty-getting-started

Python Wechaty Starter Project Template that Works Out-of-the-Box
Makefile
180
star
13

matrix-appservice

Wechaty [Matrix] Application Services Bridge
TypeScript
132
star
14

docusaurus

Wechaty Official Website for Documentations, Powered by Docusaurus.
MDX
112
star
15

puppet-wechat4u

Wechat4u Puppet for Wechaty
TypeScript
92
star
16

friday

Friday is an Assistant BOT Built on Wechaty for Serving our Community
TypeScript
81
star
17

dotnet-wechaty

.NET Wechaty is a Conversational SDK for Chatbot Makers Written in C#
C#
78
star
18

puppet-service

Wechaty Puppet Provider for providing/consuming the Wechaty Puppet Service
TypeScript
67
star
19

docker-getting-started

Getting Started Template for Docker Users
TypeScript
64
star
20

python-wechaty-template

getting started project template for python-wechaty
Python
56
star
21

php-wechaty

PHP Wechaty is a Conversational SDK for Chatbot Makers Written in PHP https://github.com/wechaty/docker-php-wechaty-getting-started
PHP
55
star
22

java-wechaty-getting-started

Java Wechaty Starter Project Template that Works Out-of-the-Box
Makefile
46
star
23

puppet-mock

Puppet Mocker for Wechaty (& A Puppet Template Starter)
TypeScript
45
star
24

go-wechaty-getting-started

Go Wechaty starter project template that works out-of-the-box
Makefile
44
star
25

bot5

Bot Friday Club - BOT5
TypeScript
39
star
26

python-wechaty-puppet-itchat

Python Wechaty Puppet Powered by Itchat
Python
38
star
27

jekyll

Wechaty Official Website for News, Blogs, Contributor Profiles, Powered by Jekyll.
Java
37
star
28

plugin-contrib

Wechaty Plugin Ecosystem Contrib Package
TypeScript
33
star
29

summer

Summer of Wechaty (SoW) is a program for connecting students with the Wechaty community for coding & tech writing.
32
star
30

chatbot-0-to-1

Chatbot Zero to One
TypeScript
31
star
31

puppet-supports

Wechaty Puppet Services (WPS)
31
star
32

rust-wechaty

Rust Wechaty is a Conversational RPA SDK for Chatbot Makers written in Rust
Rust
24
star
33

puppet-whatsapp

Wechaty Puppet for Whatsapp
TypeScript
24
star
34

puppet-lark

Wechaty Puppet for Lark
TypeScript
23
star
35

webwx-app-tracker

Live Tracking webwxApp Version Change
JavaScript
22
star
36

openapi

Wechaty REST API Server with OpenAPI Specification (aka. Swagger)
JavaScript
22
star
37

wechaty-electron

Wechaty for Desktop
JavaScript
18
star
38

puppet-official-account

Wechaty Puppet for WeChat Official Account
TypeScript
17
star
39

java-wechaty-bak

Java Wechaty is an RPA SDK for WeChat Individual Account
Java
15
star
40

botbuilder-wechaty-adapter

Microsoft Bot Framework v4 Adapter for Wechat Individual Account
TypeScript
15
star
41

puppet-oicq

Wechaty Puppet for QQ based on project takayama-lily/oicq-template
TypeScript
15
star
42

wechaty-weixin-openai

Wechaty plugin for integrate your bot with weixin openai-sdk
TypeScript
13
star
43

python-wechaty-plugin-contrib

Wechaty Plugin Ecosystem Contrib Package
Python
13
star
44

python-wechaty-puppet

Python Puppet Provider Abstraction for Wechaty
Python
12
star
45

dotnet-wechaty-getting-started

.NET Wechaty Starter Project Template that Works Out-of-the-Box
C#
11
star
46

heroku-wechaty-getting-started

Wechaty Starter Project Template with Heroku Deploy Button that Works Out-of-the-Box
TypeScript
10
star
47

puppet-walnut

Wechaty Puppet Walnut - 硬核桃5G消息
TypeScript
9
star
48

mac-wechat-app-tracker

macOS WeChat.app header files version history (automatic updated)
Objective-C
9
star
49

python-wechaty-puppet-service

Python Puppet Service Client for Wechaty
Python
8
star
50

wechaty-puppet-dingtalk

TypeScript
8
star
51

php-wechaty-getting-started

PHP Wechaty Starter Project Template that Works Out-of-the-Box
Makefile
8
star
52

scala-wechaty

Scala Wechaty is a Conversational SDK for Chatbot Makers Written in Scala
Scala
8
star
53

python-wechaty-puppet-padplus

Python Hostie Puppet for Wechaty
Python
7
star
54

easy-matrix-wechaty

A simple and fast temporary deployment solution for [matrix-appservice-wechaty](https://github.com/wechaty/matrix-appservice-wechat) with matrix. (Easy to be a multi bridge server for other matrix bridges.)
Shell
7
star
55

wishlist

Puppets, Bots, and other Tooling Requested by Community Members
6
star
56

im-aggregation

Aggregate WeCom, WeChat, and WhatsApp together.
TypeScript
6
star
57

chat

Friday BOT empowered by GPT-4 with maximum token length 32K, grounded with Wechaty SDK knowledge
5
star
58

wechaty-ui

Web UI for polyglot-wechaty based on the plugin system.
Vue
5
star
59

cqrs

An event-driven architecture wrapper for Wechaty that applies the CQS principle by using separate Query and Command messages to retrieve and modify the bot state, respectively.
TypeScript
5
star
60

vorpal-contrib

Wechaty Vorpal Chat CLI (Command Line Interface) Commands
TypeScript
4
star
61

PMC

Project Management Committees
Shell
4
star
62

wechaty-puppet-macOS

Wechaty Puppet Provider: macOS,make your macOS as a service provider for your self.
Objective-C
4
star
63

ha

High Available (HA) Wechaty is a Load Balance for providing High Availability for Wechaty Chatbot by spreading requests across multiple WeChat individual accounts.
TypeScript
4
star
64

redux

Wechaty Redux Plugin, Reducer Bundle, and Ducks Proposal Implementation.
TypeScript
4
star
65

wechaty-got-kicked-out

this is a wechaty plugin to monitor whether your bot is kicked out of group chat.
TypeScript
4
star
66

plugin-qnamaker

QnAMaker.ai Plugin for Wechaty
TypeScript
4
star
67

bot5-assistant

BOT Friday Club Meeting Assistant BOT
TypeScript
3
star
68

plugin-chatopera

🐸 Chatopera Plugin for Wechaty
TypeScript
3
star
69

sidecar-demos

Sidecar Demos & Examples
JavaScript
3
star
70

cli

Terminal Client for Wechaty
TypeScript
3
star
71

bot5-rasa-nlu

Rasa NLU for Bot5
Dockerfile
3
star
72

vorpal

CLI for Chatbot - Extensible Commands for ChatOps, Powered by Vorpal.
TypeScript
3
star
73

docker-php-wechaty-getting-started

Getting Started Template for Docker Users
Shell
2
star
74

puppet-discord

Discord Puppet for Wechaty
TypeScript
2
star
75

ducks-contrib

Wechaty Ducks Contrib
JavaScript
2
star
76

token

Wechaty Token-Based Authentication Manager
TypeScript
2
star
77

ngNext-hackthon-2020-Conversational-AI

2
star
78

plugin-freshdesk

Wechaty Freshdesk Plugin helps Freshdesk unifies conversations from WeChat, and helps you resolve issues across channels effortlessly!
TypeScript
2
star
79

chat-drive

Chat Drive is a conversational storage solution that allows you to save files from the WeChat room, and search & access them anytime by talking to our chatbot.
TypeScript
2
star
80

chatbot-1-to-2

the source code of chatbot-1-to-2
JavaScript
1
star
81

qrcode

Online QRCode Image Generator
HTML
1
star
82

php-grpc

PHP Stubs for Chatie GRPC (DO NOT EDIT: Code generated by grpc_php_plugin)
PHP
1
star
83

js.org

Wechaty Official Website for News, Blogs, Contributor Profiles, and Documentations.
1
star
84

rust-wechaty-getting-started

Rust Wechaty Starter Project Template that Works Out-of-the-Box
Makefile
1
star
85

OSSRH-56843

https://issues.sonatype.org/browse/OSSRH-56843
1
star
86

go-grpc

Go Stubs for Chatie GRPC (DO NOT EDIT: Code generated by protoc-gen-go)
1
star
87

python-wechaty-puppet-official-account

Wechaty Puppet for WeChat Official Account
Python
1
star
88

actor

Wechaty Actor Model, Powered by XState, Mailbox, and CQRS
JavaScript
1
star
89

plugin-intercom

Wechaty Intercom Plugin helps you build better customer relationships through WeChat across the customer journey.
TypeScript
1
star
90

wechaty-puppet-sidecar

A Universal Puppet Powered by Sidecar
TypeScript
1
star
91

puppet-gitter

Gitter.im Puppet for Wechaty
TypeScript
1
star
92

OSSRH-56865

https://issues.sonatype.org/browse/OSSRH-56865
1
star