commit d9414517e97801985de707c0b524085aba5caef4
Author: cori hudson <54032873+hyperobject@users.noreply.github.com>
Date: Mon Aug 26 15:00:31 2019 +0000
diff --git a/README.md b/README.md
index 50c50ca..9386025 100644
--- a/README.md
+++ b/README.md
@@ -332 +335 @@
# matterbridge
<br />
- **A simple chat bridge**<br />
- Letting people be where they want to be.<br />
- <sub>Bridges between a growing number of protocols. Click below to demo or join the development chat.</sub>
+**A simple chat bridge**<br />
+Letting people be where they want to be.<br />
+<sub>Bridges between a growing number of protocols. Click below to demo or join the development chat.</sub>
- [Gitter][mb-gitter] |
- [IRC][mb-irc] |
- [Discord][mb-discord] |
- [Matrix][mb-matrix] |
- [Slack][mb-slack] |
- [Mattermost][mb-mattermost] |
- [Rocket.Chat][mb-rocketchat] |
- [XMPP][mb-xmpp] |
- [Twitch][mb-twitch] |
- [WhatsApp][mb-whatsapp] |
- [Zulip][mb-zulip] |
- [Telegram][mb-telegram] |
- And more...
- </sup>
-
-----
+[Gitter][mb-gitter] |
+[IRC][mb-irc] |
+[Discord][mb-discord] |
+[Matrix][mb-matrix] |
+[Slack][mb-slack] |
+[Mattermost][mb-mattermost] |
+[Rocket.Chat][mb-rocketchat] |
+[XMPP][mb-xmpp] |
+[Twitch][mb-twitch] |
+[WhatsApp][mb-whatsapp] |
+[Zulip][mb-zulip] |
+[Telegram][mb-telegram] |
+[Keybase][mb-keybase] |
+And more...
+</sup>
+
+---
+
[](https://github.com/42wim/matterbridge/releases/latest)
- [](https://bintray.com/42wim/nightly/Matterbridge/_latestVersion)
- [](https://codeclimate.com/github/42wim/matterbridge/maintainability)
- [](https://codeclimate.com/github/42wim/matterbridge/test_coverage)<br />
+[](https://bintray.com/42wim/nightly/Matterbridge/_latestVersion)
+[](https://codeclimate.com/github/42wim/matterbridge/maintainability)
+[](https://codeclimate.com/github/42wim/matterbridge/test_coverage)<br />
+
<hr />
</div>
<div align="right"><sup>
@@ -42108 +45118 @@
</p>
### Table of Contents
- * [Features](https://github.com/42wim/matterbridge/wiki/Features)
- * [Natively supported](#natively-supported)
- * [3rd party via matterbridge api](#3rd-party-via-matterbridge-api)
- * [API](#API)
- * [Chat with us](#chat-with-us)
- * [Screenshots](https://github.com/42wim/matterbridge/wiki/)
- * [Installing/upgrading](#installing--upgrading)
- * [Binaries](#binaries)
- * [Building](#building)
- * [Configuration](#configuration)
- * [Howto](https://github.com/42wim/matterbridge/wiki/How-to-create-your-config)
- * [Settings](#settings)
- * [Examples](#examples)
- * [Running](#running)
- * [Docker](#docker)
- * [Changelog](#changelog)
- * [FAQ](#faq)
- * [Related projects](#related-projects)
- * [Articles](#articles)
- * [Thanks](#thanks)
+
+- [Features](https://github.com/42wim/matterbridge/wiki/Features)
+ - [Natively supported](#natively-supported)
+ - [3rd party via matterbridge api](#3rd-party-via-matterbridge-api)
+ - [API](#API)
+- [Chat with us](#chat-with-us)
+- [Screenshots](https://github.com/42wim/matterbridge/wiki/)
+- [Installing/upgrading](#installing--upgrading)
+ - [Binaries](#binaries)
+- [Building](#building)
+- [Configuration](#configuration)
+ - [Howto](https://github.com/42wim/matterbridge/wiki/How-to-create-your-config)
+ - [Settings](#settings)
+ - [Examples](#examples)
+- [Running](#running)
+ - [Docker](#docker)
+- [Changelog](#changelog)
+- [FAQ](#faq)
+- [Related projects](#related-projects)
+- [Articles](#articles)
+- [Thanks](#thanks)
## Features
-* [Support bridging between any protocols](https://github.com/42wim/matterbridge/wiki/Features#support-bridging-between-any-protocols)
-* [Support multiple gateways(bridges) for your protocols](https://github.com/42wim/matterbridge/wiki/Features#support-multiple-gatewaysbridges-for-your-protocols)
-* [Message edits and deletes](https://github.com/42wim/matterbridge/wiki/Features#message-edits-and-deletes)
-* Preserves threading when possible
-* [Attachment / files handling](https://github.com/42wim/matterbridge/wiki/Features#attachment--files-handling)
-* [Username and avatar spoofing](https://github.com/42wim/matterbridge/wiki/Features#username-and-avatar-spoofing)
-* [Private groups](https://github.com/42wim/matterbridge/wiki/Features#private-groups)
-* [API](https://github.com/42wim/matterbridge/wiki/Features#api)
+
+- [Support bridging between any protocols](https://github.com/42wim/matterbridge/wiki/Features#support-bridging-between-any-protocols)
+- [Support multiple gateways(bridges) for your protocols](https://github.com/42wim/matterbridge/wiki/Features#support-multiple-gatewaysbridges-for-your-protocols)
+- [Message edits and deletes](https://github.com/42wim/matterbridge/wiki/Features#message-edits-and-deletes)
+- Preserves threading when possible
+- [Attachment / files handling](https://github.com/42wim/matterbridge/wiki/Features#attachment--files-handling)
+- [Username and avatar spoofing](https://github.com/42wim/matterbridge/wiki/Features#username-and-avatar-spoofing)
+- [Private groups](https://github.com/42wim/matterbridge/wiki/Features#private-groups)
+- [API](https://github.com/42wim/matterbridge/wiki/Features#api)
### Natively supported
-* [Mattermost](https://github.com/mattermost/mattermost-server/) 4.x, 5.x
-* [IRC](http://www.mirc.com/servers.html)
-* [XMPP](https://xmpp.org)
-* [Gitter](https://gitter.im)
-* [Slack](https://slack.com)
-* [Discord](https://discordapp.com)
-* [Telegram](https://telegram.org)
-* [Rocket.chat](https://rocket.chat)
-* [Matrix](https://matrix.org)
-* [Steam](https://store.steampowered.com/)
-* [Twitch](https://twitch.tv)
-* [Ssh-chat](https://github.com/shazow/ssh-chat)
-* [WhatsApp](https://www.whatsapp.com/)
-* [Zulip](https://zulipchat.com)
+- [Mattermost](https://github.com/mattermost/mattermost-server/) 4.x, 5.x
+- [IRC](http://www.mirc.com/servers.html)
+- [XMPP](https://xmpp.org)
+- [Gitter](https://gitter.im)
+- [Slack](https://slack.com)
+- [Discord](https://discordapp.com)
+- [Telegram](https://telegram.org)
+- [Rocket.chat](https://rocket.chat)
+- [Matrix](https://matrix.org)
+- [Steam](https://store.steampowered.com/)
+- [Twitch](https://twitch.tv)
+- [Ssh-chat](https://github.com/shazow/ssh-chat)
+- [WhatsApp](https://www.whatsapp.com/)
+- [Zulip](https://zulipchat.com)
+- [Keybase](https://keybase.io)
### 3rd party via matterbridge api
-* [Minecraft](https://github.com/elytra/MatterLink)
-* [Reddit](https://github.com/bonehurtingjuice/mattereddit)
-* [Facebook messenger](https://github.com/VictorNine/fbridge)
-* [Discourse](https://github.com/DeclanHoare/matterbabble)
+
+- [Minecraft](https://github.com/elytra/MatterLink)
+- [Reddit](https://github.com/bonehurtingjuice/mattereddit)
+- [Facebook messenger](https://github.com/VictorNine/fbridge)
+- [Discourse](https://github.com/DeclanHoare/matterbabble)
### API
+
The API is basic at the moment.
More info and examples on the [wiki](https://github.com/42wim/matterbridge/wiki/Api).
Used by the projects below. Feel free to make a PR to add your project to this list.
-* [MatterLink](https://github.com/elytra/MatterLink) (Matterbridge link for Minecraft Server chat)
-* [pyCord](https://github.com/NikkyAI/pyCord) (crossplatform chatbot)
-* [Mattereddit](https://github.com/bonehurtingjuice/mattereddit) (Reddit chat support)
-* [fbridge](https://github.com/VictorNine/fbridge) (Facebook messenger support)
-* [matterbabble](https://github.com/DeclanHoare/matterbabble) (Discourse support)
+- [MatterLink](https://github.com/elytra/MatterLink) (Matterbridge link for Minecraft Server chat)
+- [pyCord](https://github.com/NikkyAI/pyCord) (crossplatform chatbot)
+- [Mattereddit](https://github.com/bonehurtingjuice/mattereddit) (Reddit chat support)
+- [fbridge](https://github.com/VictorNine/fbridge) (Facebook messenger support)
+- [matterbabble](https://github.com/DeclanHoare/matterbabble) (Discourse support)
## Chat with us
Questions or want to test on your favorite platform? Join below:
-* [Gitter][mb-gitter]
-* [IRC][mb-irc]
-* [Discord][mb-discord]
-* [Matrix][mb-matrix]
-* [Slack][mb-slack]
-* [Mattermost][mb-mattermost]
-* [Rocket.Chat][mb-rocketchat]
-* [XMPP][mb-xmpp] (matterbridge@conference.jabber.de)
-* [Twitch][mb-twitch]
-* [Zulip][mb-zulip]
-* [Telegram][mb-telegram]
+- [Gitter][mb-gitter]
+- [IRC][mb-irc]
+- [Discord][mb-discord]
+- [Matrix][mb-matrix]
+- [Slack][mb-slack]
+- [Mattermost][mb-mattermost]
+- [Rocket.Chat][mb-rocketchat]
+- [XMPP][mb-xmpp] (matterbridge@conference.jabber.de)
+- [Twitch][mb-twitch]
+- [Zulip][mb-zulip]
+- [Telegram][mb-telegram]
## Screenshots
+
See https://github.com/42wim/matterbridge/wiki
## Installing / upgrading
+
### Binaries
-* Latest stable release [v1.15.1](https://github.com/42wim/matterbridge/releases/latest)
-* Development releases (follows master) can be downloaded [here](https://dl.bintray.com/42wim/nightly/)
+
+- Latest stable release [v1.15.1](https://github.com/42wim/matterbridge/releases/latest)
+- Development releases (follows master) can be downloaded [here](https://dl.bintray.com/42wim/nightly/)
To install or upgrade just download the latest [binary](https://github.com/42wim/matterbridge/releases/latest) and follow the instructions on the [howto](https://github.com/42wim/matterbridge/wiki/How-to-create-your-config) for a step by step walkthrough for creating your configuration.
### Packages
-* [Overview](https://repology.org/metapackage/matterbridge/versions)
+
+- [Overview](https://repology.org/metapackage/matterbridge/versions)
## Building
+
Most people just want to use binaries, you can find those [here](https://github.com/42wim/matterbridge/releases/latest)
If you really want to build from source, follow these instructions:
Go 1.9+ is required. Make sure you have [Go](https://golang.org/doc/install) properly installed, including setting up your [GOPATH](https://golang.org/doc/code.html#GOPATH).
-After Go is setup, download matterbridge to your $GOPATH directory.
+After Go is setup, download matterbridge to your \$GOPATH directory.
```
cd $GOPATH
@@ -15817 +17123 @@ matterbridge
```
## Configuration
+
### Basic configuration
+
See [howto](https://github.com/42wim/matterbridge/wiki/How-to-create-your-config) for a step by step walkthrough for creating your configuration.
### Settings
+
All possible [settings](https://github.com/42wim/matterbridge/wiki/Settings) for each bridge.
### Advanced configuration
-* [matterbridge.toml.sample](https://github.com/42wim/matterbridge/blob/master/matterbridge.toml.sample) for documentation and an example.
+
+- [matterbridge.toml.sample](https://github.com/42wim/matterbridge/blob/master/matterbridge.toml.sample) for documentation and an example.
### Examples
+
#### Bridge mattermost (off-topic) - irc (#testing)
+
```toml
[irc]
@@ -1976 +2167 @@ enable=true
```
#### Bridge slack (#general) - discord (general)
+
```toml
[slack]
[slack.test]
@@ -24112 +26115 @@ Usage of ./matterbridge:
```
### Docker
+
Create your matterbridge.toml file locally eg in `/tmp/matterbridge.toml`
+
```
docker run -ti -v /tmp/matterbridge.toml:/matterbridge.toml 42wim/matterbridge
```
## Changelog
+
See [changelog.md](https://github.com/42wim/matterbridge/blob/master/changelog.md)
## FAQ
@@ -25428 +27730 @@ See [changelog.md](https://github.com/42wim/matterbridge/blob/master/changelog.m
See [FAQ](https://github.com/42wim/matterbridge/wiki/FAQ)
## Related projects
-* [FOSSRIT/infrastructure - roles/matterbridge](https://github.com/FOSSRIT/infrastructure/tree/master/roles/matterbridge) (Ansible role used to automate deployments of Matterbridge)
-* [matterbridge autoconfig](https://github.com/patcon/matterbridge-autoconfig)
-* [matterbridge config viewer](https://github.com/patcon/matterbridge-heroku-viewer)
-* [matterbridge-heroku](https://github.com/cadecairos/matterbridge-heroku)
-* [mattereddit](https://github.com/bonehurtingjuice/mattereddit)
-* [matterlink](https://github.com/elytra/MatterLink)
-* [mattermost-plugin](https://github.com/matterbridge/mattermost-plugin) - Run matterbridge as a plugin in mattermost
-* [pyCord](https://github.com/NikkyAI/pyCord) (crossplatform chatbot)
-* [fbridge](https://github.com/VictorNine/fbridge) (Facebook messenger support)
-* [isla](https://github.com/alphachung/isla) (Bot for Discord-Telegram groups used alongside matterbridge)
-* [matterbabble](https://github.com/DeclanHoare/matterbabble) (Connect Discourse threads to Matterbridge)
+
+- [FOSSRIT/infrastructure - roles/matterbridge](https://github.com/FOSSRIT/infrastructure/tree/master/roles/matterbridge) (Ansible role used to automate deployments of Matterbridge)
+- [matterbridge autoconfig](https://github.com/patcon/matterbridge-autoconfig)
+- [matterbridge config viewer](https://github.com/patcon/matterbridge-heroku-viewer)
+- [matterbridge-heroku](https://github.com/cadecairos/matterbridge-heroku)
+- [mattereddit](https://github.com/bonehurtingjuice/mattereddit)
+- [matterlink](https://github.com/elytra/MatterLink)
+- [mattermost-plugin](https://github.com/matterbridge/mattermost-plugin) - Run matterbridge as a plugin in mattermost
+- [pyCord](https://github.com/NikkyAI/pyCord) (crossplatform chatbot)
+- [fbridge](https://github.com/VictorNine/fbridge) (Facebook messenger support)
+- [isla](https://github.com/alphachung/isla) (Bot for Discord-Telegram groups used alongside matterbridge)
+- [matterbabble](https://github.com/DeclanHoare/matterbabble) (Connect Discourse threads to Matterbridge)
## Articles
-* [matterbridge on kubernetes](https://medium.freecodecamp.org/using-kubernetes-to-deploy-a-chat-gateway-or-when-technology-works-like-its-supposed-to-a169a8cd69a3)
-* https://mattermost.com/blog/connect-irc-to-mattermost/
-* https://blog.valvin.fr/2016/09/17/mattermost-et-un-channel-irc-cest-possible/
-* https://blog.brightscout.com/top-10-mattermost-integrations/
-* http://bencey.co.nz/2018/09/17/bridge/
-* https://www.algoo.fr/blog/2018/01/19/recouvrez-votre-liberte-en-quittant-slack-pour-un-mattermost-auto-heberge/
-* https://kopano.com/blog/matterbridge-bridging-mattermost-chat/
-* https://www.stitcher.com/s/?eid=52382713
-* https://daniele.tech/2019/02/how-to-use-matterbridge-to-connect-2-different-slack-workspaces/
+
+- [matterbridge on kubernetes](https://medium.freecodecamp.org/using-kubernetes-to-deploy-a-chat-gateway-or-when-technology-works-like-its-supposed-to-a169a8cd69a3)
+- https://mattermost.com/blog/connect-irc-to-mattermost/
+- https://blog.valvin.fr/2016/09/17/mattermost-et-un-channel-irc-cest-possible/
+- https://blog.brightscout.com/top-10-mattermost-integrations/
+- http://bencey.co.nz/2018/09/17/bridge/
+- https://www.algoo.fr/blog/2018/01/19/recouvrez-votre-liberte-en-quittant-slack-pour-un-mattermost-auto-heberge/
+- https://kopano.com/blog/matterbridge-bridging-mattermost-chat/
+- https://www.stitcher.com/s/?eid=52382713
+- https://daniele.tech/2019/02/how-to-use-matterbridge-to-connect-2-different-slack-workspaces/
## Thanks
@@ -28734 +31237 @@ See [FAQ](https://github.com/42wim/matterbridge/wiki/FAQ)
</p>
Matterbridge wouldn't exist without these libraries:
-* discord - https://github.com/bwmarrin/discordgo
-* echo - https://github.com/labstack/echo
-* gitter - https://github.com/sromku/go-gitter
-* gops - https://github.com/google/gops
-* gozulipbot - https://github.com/ifo/gozulipbot
-* irc - https://github.com/lrstanley/girc
-* mattermost - https://github.com/mattermost/mattermost-server
-* matrix - https://github.com/matrix-org/gomatrix
-* sshchat - https://github.com/shazow/ssh-chat
-* slack - https://github.com/nlopes/slack
-* steam - https://github.com/Philipp15b/go-steam
-* telegram - https://github.com/go-telegram-bot-api/telegram-bot-api
-* xmpp - https://github.com/mattn/go-xmpp
-* whatsapp - https://github.com/Rhymen/go-whatsapp/
-* zulip - https://github.com/ifo/gozulipbot
-* tengo - https://github.com/d5/tengo
+
+- discord - https://github.com/bwmarrin/discordgo
+- echo - https://github.com/labstack/echo
+- gitter - https://github.com/sromku/go-gitter
+- gops - https://github.com/google/gops
+- gozulipbot - https://github.com/ifo/gozulipbot
+- irc - https://github.com/lrstanley/girc
+- mattermost - https://github.com/mattermost/mattermost-server
+- matrix - https://github.com/matrix-org/gomatrix
+- sshchat - https://github.com/shazow/ssh-chat
+- slack - https://github.com/nlopes/slack
+- steam - https://github.com/Philipp15b/go-steam
+- telegram - https://github.com/go-telegram-bot-api/telegram-bot-api
+- xmpp - https://github.com/mattn/go-xmpp
+- whatsapp - https://github.com/Rhymen/go-whatsapp/
+- zulip - https://github.com/ifo/gozulipbot
+- tengo - https://github.com/d5/tengo
+- keybase - https://github.com/keybase/go-keybase-chat-bot
<!-- Links -->
- [mb-gitter]: https://gitter.im/42wim/matterbridge
- [mb-irc]: https://webchat.freenode.net/?channels=matterbridgechat
- [mb-discord]: https://discord.gg/AkKPtrQ
- [mb-matrix]: https://riot.im/app/#/room/#matterbridge:matrix.org
- [mb-slack]: https://join.slack.com/matterbridgechat/shared_invite/MjEwODMxNjU1NDMwLTE0OTk2MTU3NTMtMzZkZmRiNDZhOA
- [mb-mattermost]: https://framateam.org/signup_user_complete/?id=tfqm33ggop8x3qgu4boeieta6e
- [mb-rocketchat]: https://open.rocket.chat/channel/matterbridge
- [mb-xmpp]: https://inverse.chat/
- [mb-twitch]: https://www.twitch.tv/matterbridge
- [mb-whatsapp]: https://www.whatsapp.com/
- [mb-zulip]: https://matterbridge.zulipchat.com/register/
- [mb-telegram]: https://t.me/Matterbridge
+[mb-gitter]: https://gitter.im/42wim/matterbridge
+[mb-irc]: https://webchat.freenode.net/?channels=matterbridgechat
+[mb-discord]: https://discord.gg/AkKPtrQ
+[mb-matrix]: https://riot.im/app/#/room/#matterbridge:matrix.org
+[mb-slack]: https://join.slack.com/matterbridgechat/shared_invite/MjEwODMxNjU1NDMwLTE0OTk2MTU3NTMtMzZkZmRiNDZhOA
+[mb-mattermost]: https://framateam.org/signup_user_complete/?id=tfqm33ggop8x3qgu4boeieta6e
+[mb-rocketchat]: https://open.rocket.chat/channel/matterbridge
+[mb-xmpp]: https://inverse.chat/
+[mb-twitch]: https://www.twitch.tv/matterbridge
+[mb-whatsapp]: https://www.whatsapp.com/
+[mb-keybase]: https://keybase.io
+[mb-zulip]: https://matterbridge.zulipchat.com/register/
+[mb-telegram]: https://t.me/Matterbridge
diff --git a/bridge/config/config.go b/bridge/config/config.go
index e7d8da5..cf6872a 100644
--- a/bridge/config/config.go
+++ b/bridge/config/config.go
@@ -1317 +1317 @@ type Protocol struct {
StripNick bool // all protocols
SyncTopic bool // slack
TengoModifyMessage string // general
- Team string // mattermost
+ Team string // mattermost, keybase
Token string // gitter, slack, discord, api
Topic string // zulip
URL string // mattermost, slack // DEPRECATED
@@ -1986 +1987 @@ type BridgeValues struct {
SSHChat map[string]Protocol
WhatsApp map[string]Protocol // TODO is this struct used? Search for "SlackLegacy" for example didn't return any results
Zulip map[string]Protocol
+ Keybase map[string]Protocol
General Protocol
Tengo Tengo
Gateway []Gateway
diff --git a/bridge/keybase/handlers.go b/bridge/keybase/handlers.go
new file mode 100644
index 0000000..165aeb1
--- /dev/null
+++ b/bridge/keybase/handlers.go
@@ -00 +159 @@
+package bkeybase
+
+import (
+ "strconv"
+
+ "github.com/42wim/matterbridge/bridge/config"
+ "github.com/keybase/go-keybase-chat-bot/kbchat"
+)
+
+func (b *Bkeybase) handleKeybase() {
+ sub, err := b.kbc.ListenForNewTextMessages()
+ if err != nil {
+ b.Log.Errorf("Error listening: %s", err.Error())
+ }
+
+ go func() {
+ for {
+ msg, err := sub.Read()
+ if err != nil {
+ b.Log.Errorf("failed to read message: %s", err.Error())
+ }
+
+ if msg.Message.Content.Type != "text" {
+ continue
+ }
+
+ if msg.Message.Sender.Username == b.kbc.GetUsername() {
+ continue
+ }
+
+ b.handleMessage(msg.Message)
+
+ }
+ }()
+}
+
+func (b *Bkeybase) handleMessage(msg kbchat.Message) {
+ b.Log.Debugf("== Receiving event: %#v", msg)
+ if msg.Channel.TopicName != b.channel || msg.Channel.Name != b.team {
+ return
+ }
+
+ if msg.Sender.Username != b.kbc.GetUsername() {
+
+ // TODO download avatar
+
+ // Create our message
+ rmsg := config.Message{Username: msg.Sender.Username, Text: msg.Content.Text.Body, UserID: msg.Sender.Uid, Channel: msg.Channel.TopicName, ID: strconv.Itoa(msg.MsgID), Account: b.Account}
+
+ // Text must be a string
+ if msg.Content.Type != "text" {
+ b.Log.Errorf("message is not text")
+ return
+ }
+
+ b.Log.Debugf("<= Sending message from %s on %s to gateway", msg.Sender.Username, msg.Channel.Name)
+ b.Remote <- rmsg
+ }
+}
diff --git a/bridge/keybase/keybase.go b/bridge/keybase/keybase.go
new file mode 100644
index 0000000..a4b1274
--- /dev/null
+++ b/bridge/keybase/keybase.go
@@ -00 +182 @@
+package bkeybase
+
+import (
+ "strconv"
+
+ "github.com/42wim/matterbridge/bridge"
+ "github.com/42wim/matterbridge/bridge/config"
+ "github.com/keybase/go-keybase-chat-bot/kbchat"
+)
+
+// Bkeybase bridge structure
+type Bkeybase struct {
+ kbc *kbchat.API
+ user string
+ channel string
+ team string
+ *bridge.Config
+}
+
+// New initializes Bkeybase object and sets team
+func New(cfg *bridge.Config) bridge.Bridger {
+ b := &Bkeybase{Config: cfg}
+ b.team = b.Config.GetString("Team")
+ return b
+}
+
+// Connect starts keybase API and listener loop
+func (b *Bkeybase) Connect() error {
+ var err error
+ b.Log.Infof("Connecting %s", b.GetString("Team"))
+
+ // use default keybase location (`keybase`)
+ b.kbc, err = kbchat.Start(kbchat.RunOptions{})
+ if err != nil {
+ return err
+ }
+ b.user = b.kbc.GetUsername()
+ b.Log.Info("Connection succeeded")
+ go b.handleKeybase()
+ return nil
+}
+
+// Disconnect doesn't do anything for now
+func (b *Bkeybase) Disconnect() error {
+ return nil
+}
+
+// JoinChannel sets channel name in struct
+func (b *Bkeybase) JoinChannel(channel config.ChannelInfo) error {
+ if _, err := b.kbc.JoinChannel(b.team, channel.Name); err != nil {
+ return err
+ }
+ b.channel = channel.Name
+ return nil
+}
+
+// Send receives bridge messages and sends them to Keybase chat room
+func (b *Bkeybase) Send(msg config.Message) (string, error) {
+ b.Log.Debugf("=> Receiving %#v", msg)
+
+ // Handle /me events
+ if msg.Event == config.EventUserAction {
+ msg.Text = "_" + msg.Text + "_"
+ }
+
+ // Delete message if we have an ID
+ // Delete message not supported by keybase go library yet
+
+ // Upload a file if it exists
+ // kbchat lib does not support attachments yet
+
+ // Edit message if we have an ID
+ // kbchat lib does not support message editing yet
+
+ // Send regular message
+ resp, err := b.kbc.SendMessageByTeamName(b.team, msg.Username+msg.Text, &b.channel)
+ if err != nil {
+ return "", err
+ }
+
+ return strconv.Itoa(resp.Result.MsgID), err
+}
diff --git a/gateway/bridgemap/bridgemap.go b/gateway/bridgemap/bridgemap.go
index 6ce7157..599df7b 100644
--- a/gateway/bridgemap/bridgemap.go
+++ b/gateway/bridgemap/bridgemap.go
@@ -66 +67 @@ import (
bdiscord "github.com/42wim/matterbridge/bridge/discord"
bgitter "github.com/42wim/matterbridge/bridge/gitter"
birc "github.com/42wim/matterbridge/bridge/irc"
+ bkeybase "github.com/42wim/matterbridge/bridge/keybase"
bmatrix "github.com/42wim/matterbridge/bridge/matrix"
bmattermost "github.com/42wim/matterbridge/bridge/mattermost"
brocketchat "github.com/42wim/matterbridge/bridge/rocketchat"
@@ -356 +367 @@ var (
"whatsapp": bwhatsapp.New,
"xmpp": bxmpp.New,
"zulip": bzulip.New,
+ "keybase": bkeybase.New,
}
UserTypingSupport = map[string]struct{}{
diff --git a/go.mod b/go.mod
index 4f5ec0d..91467bf 100644
--- a/go.mod
+++ b/go.mod
@@ -206 +207 @@ require (
github.com/hpcloud/tail v1.0.0 // indirect
github.com/jpillora/backoff v0.0.0-20180909062703-3050d21c67d7
github.com/jtolds/gls v4.2.1+incompatible // indirect
+ github.com/keybase/go-keybase-chat-bot v0.0.0-20190816161829-561f10822eb2
github.com/labstack/echo/v4 v4.1.6
github.com/lrstanley/girc v0.0.0-20190210212025-51b8e096d398
github.com/lusis/go-slackbot v0.0.0-20180109053408-401027ccfef5 // indirect
@@ -597 +6010 @@ require (
gitlab.com/golang-commonmark/mdurl v0.0.0-20180912090424-e5bce34c34f2 // indirect
gitlab.com/golang-commonmark/puny v0.0.0-20180912090636-2cd490539afe // indirect
gitlab.com/opennota/wd v0.0.0-20180912061657-c5d65f63c638 // indirect
+ golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586 // indirect
golang.org/x/image v0.0.0-20190616094056-33659d3de4f5
+ golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 // indirect
+ golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a // indirect
gopkg.in/fsnotify.v1 v1.4.7 // indirect
gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7 // indirect
diff --git a/go.sum b/go.sum
index 50392f9..39ca4af 100644
--- a/go.sum
+++ b/go.sum
@@ -946 +948 @@ github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVY
github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w=
github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1 h1:PJPDf8OUfOK1bb/NeTKd4f1QXZItOX389VN3B6qC8ro=
github.com/kardianos/osext v0.0.0-20170510131534-ae77be60afb1/go.mod h1:1NbS8ALrpOvjt0rHPNLyCIeMtbizbir8U//inJ+zuB8=
+github.com/keybase/go-keybase-chat-bot v0.0.0-20190816161829-561f10822eb2 h1:zacJswvfPqUSGdcBXJzKvLN/dB1UjDGDvDesMBBzoA4=
+github.com/keybase/go-keybase-chat-bot v0.0.0-20190816161829-561f10822eb2/go.mod h1:vNc28YFzigVJod0j5EbuTtRIe7swx8vodh2yA4jZ2s8=
github.com/keybase/go-ps v0.0.0-20161005175911-668c8856d999 h1:2d+FLQbz4xRTi36DO1qYNUwfORax9XcQ0jhbO81Vago=
github.com/keybase/go-ps v0.0.0-20161005175911-668c8856d999/go.mod h1:hY+WOq6m2FpbvyrI93sMaypsttvaIL5nhVR92dTMUcQ=
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
@@ -2656 +2678 @@ golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2 h1:VklqNMn3ovrHsnt90Pveol
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5 h1:58fnuSXlxZmFdJyvtTFVmVhcMLU6v5fEb/ok4wyqtNU=
golang.org/x/crypto v0.0.0-20190605123033-f99c8df09eb5/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
+golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586 h1:7KByu05hhLed2MO29w7p1XfZvZ13m8mub3shuVftRs0=
+golang.org/x/crypto v0.0.0-20190820162420-60c769a6c586/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
golang.org/x/image v0.0.0-20190616094056-33659d3de4f5 h1:ngW7cqsJcNIFizl289rKwy+nVvw7TQS8z3ejrra6syo=
golang.org/x/image v0.0.0-20190616094056-33659d3de4f5/go.mod h1:FeLwcggjj3mMvU+oOTbSwawSJRM1uh48EjtB4UJZlP0=
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
@@ -2786 +2828 @@ golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn
golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
golang.org/x/net v0.0.0-20190607181551-461777fb6f67 h1:rJJxsykSlULwd2P2+pg/rtnwN2FrWp4IuCxOSyS0V00=
golang.org/x/net v0.0.0-20190607181551-461777fb6f67/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
+golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7 h1:fHDIZ2oxGnUZRN6WgWFCbYBjH9uqVPRCUVUDhs0wnbA=
+golang.org/x/net v0.0.0-20190813141303-74dc4d7220e7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
@@ -2976 +3038 @@ golang.org/x/sys v0.0.0-20190422165155-953cdadca894/go.mod h1:h1NjWce9XRLGQEsW7w
golang.org/x/sys v0.0.0-20190602015325-4c4f7f33c9ed/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/sys v0.0.0-20190609082536-301114b31cce h1:CQakrGkKbydnUmt7cFIlmQ4lNQiqdTPt6xzXij4nYCc=
golang.org/x/sys v0.0.0-20190609082536-301114b31cce/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
+golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a h1:aYOabOQFp6Vj6W1F80affTUvO9UxmJRx8K0gsfABByQ=
+golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
golang.org/x/text v0.3.0 h1:g61tztE5qeGQ89tm6NTjjM9VPIm088od1l6aSorWRWg=
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
golang.org/x/text v0.3.2 h1:tW2bmiBqwgJj/UpqtC8EpXEZVYOwU0yG4iWbprSVAcs=
diff --git a/matterbridge.toml.sample b/matterbridge.toml.sample
index 4a50aed..de75c8d 100644
--- a/matterbridge.toml.sample
+++ b/matterbridge.toml.sample
@@ -5226 +52229 @@ StripNick=false
#OPTIONAL (default false)
ShowTopicChange=false
+###################################################################
+#
+# Keybase
+# You should have a separate bridge account on Keybase
+# (it also needs to be logged in on the system you're running the bridge on)
+#
+###################################################################
+
+[keybase.myteam]
+
+# RemoteNickFormat defines how remote users appear on this bridge
+# See [general] config section for default options
+RemoteNickFormat="{NICK} ({PROTOCOL}): "
+
+# extra label that can be used in the RemoteNickFormat
+# optional (default empty)
+Label=""
+
+# Your team on Keybase.
+# The bot user MUST be a member of this team
+# REQUIRED
+Team="myteam"
+
###################################################################
#slack section
###################################################################