Package: chatroom-syncer
Chatroom-SyncerChatroom-Syncer is a project to sync IM Chat Room to the public domain like IRC in the old days, so that the information, context and history of communication could be discoverred, learnt from and referenced by others, anyware, anytime.https://user-images.githubusercontent.com/1651790/207810877-b86943fa-24b3-479c-ac25-d602a6c5d53c.mp4Supported SinksSlackGitHubIRCTelegramDiscordComponents and FlowComponentDocker Imageswechaty-gatewaychatroom-syncerThere are two processes in the system:Chatroom Syncer, current code base in Python as the WeChaty Client and the botWeChaty Gateway, which leverages the Wechaty with UOS Wechat Client(also named as a puppet) to be called by the Chatroom Syncer due to WebChaty is not a native Python library, and the Wechaty Gateway is a gRPC server to manipulate and watch WeChat the puppet.Thus, we need to start the WeChaty Gateway before the Chatroom Syncer.┌────────────────────────────┐          ┌────────┐
│                            │          │        │
│ Chatroom Syncer            │          │        │
│                            │          │ GitHub │
│ WebChaty.onMessage()       ├──────────▶ Slack  │
│                            │          │        │
└──────────────▲─────────────┘          │        │
               │                        └────────┘
             gRPC
               │
┌──────────────▼──────────────┐
│                             │
│  Wechaty Gateway            │
│                             │
│┌────────────────────────┐   │
││ Wechaty UOS puppet     │   │
│└────────────────────────┘   │
└─────────────────────────────┘RunBefore running, we need follow prerequisites:Configure WeChat Group Names and Slack Channel Names inconfig.yaml, they should exist in both WeChat and Slack.Configure Slack API Token in.env.Run with DockerRun it in background:cpconfig-example.yamlconfig.yaml
cpenv-example.env
docker-composeup-dCheck both containers are Up:docker-composepsIn case there are anyExit 0containers, give another try of starting up:docker-composeup-dScan the QR code with your WeChat App, and you are ready to go!dockerlogschatroom-syncer_chatroom-syncer_12>/dev/null|grep-vWechatyStop it:docker-composedownRun from hostRun Webchaty gateway first:exporttoken="iwonttellyou"dockerrun-d\--name=wechaty-gateway\--net=bridge\-p9009:9009\-eWECHATY_PUPPET_SERVICE_TOKEN="$token"\-v/wechaty_data:/wechaty/data\--restart=unless-stoppedweygu/wechaty-gateway:latestRun Chatroom-Syncer:# install itpython3-mpipinstallchatroom-syncer# create config.yaml and change itcpconfig-example.yamlconfig.yaml# put tokens for sink according to your config.yaml# i.e. if both slack and github discussion sinks were enabled# we need token to send message to slack and github discussion# as follow:exportSLACK_BOT_TOKEN="xoxb-1234567890-1234567890-1234567890-1234567890"exportGITHUB_TOKEN=ghp_xxxxxxxxxxxxxxxxx# run itpython3-mchatroom_syncerConfigurationWeChatCopy the config-example.yaml to config.yamlcpconfig-example.yamlconfig.yamlAnd fill in the following fields in the table:FieldDescriptionenable_slackSwitch of slack sinkgroup_channel_mappingMapping WeChat group name to Slack channel nameenable_avatarSwitch to generate emoji-based avatar for Slack sinkenable_github_discussionSwitch of Github Discussion sinkgroup_github_discussion_mappingMapping WeChat group name to discussion:owner/repo/categoryContributeBuild from hostgitclonehttps://github.com/wey-gu/chatroom-syncer&&cdchatroom-syncer# install pdmcurl-sSLhttps://raw.githubusercontent.com/pdm-project/pdm/main/install-pdm.py|python3-# install chatroom-syncerpdminstallIf dependencies are updated, runpdm syncto update the lock manifest.pdmsyncBuild from dockerdocker-compose-fdocker-compose.dev.yamlbuild
docker-compose-fdocker-compose.dev.yamlup-d# get QR code to scandockerlogschatroom-syncer_chatroom-syncer_12>/dev/null|grep-vWechaty# watch logs of the chatroom syncerdockerlogschatroom-syncer_chatroom-syncer_1--follow# stop the chatroom syncer and remove the containerdocker-compose-fdocker-compose.dev.yamldownlinting# install pre-commitpipinstallpre-commit# run pre-commitpre-commitrun--all-files