Thumbnail

rani/matterbridge.git

Clone URL: https://git.buni.party/rani/matterbridge.git

commit ee71fa519c48255a1dfbcb0c481d05fe38a476ed Author: Janet Blackquill <uhhadd@gmail.com> Date: Sat Dec 18 16:43:29 2021 +0000 Add support for Harmony (#1656) Harmony is a relatively new (1,5yo) chat protocol with a small community. This introduces support for Harmony into Matterbridge, using the functionality specifically designed for bridge bots. The implementation is a modest 200 lines of code. diff --git a/bridge/harmony/harmony.go b/bridge/harmony/harmony.go new file mode 100644 index 0000000..14174c3 --- /dev/null +++ b/bridge/harmony/harmony.go @@ -00 +1252 @@ +package harmony + +import ( + "fmt" + "log" + "strconv" + "strings" + "time" + + "github.com/42wim/matterbridge/bridge" + "github.com/42wim/matterbridge/bridge/config" + "github.com/harmony-development/shibshib" + chatv1 "github.com/harmony-development/shibshib/gen/chat/v1" + typesv1 "github.com/harmony-development/shibshib/gen/harmonytypes/v1" + profilev1 "github.com/harmony-development/shibshib/gen/profile/v1" +) + +type cachedProfile struct { + data *profilev1.GetProfileResponse + lastUpdated time.Time +} + +type Bharmony struct { + *bridge.Config + + c *shibshib.Client + profileCache map[uint64]cachedProfile +} + +func uToStr(in uint64) string { + return strconv.FormatUint(in, 10) +} + +func strToU(in string) (uint64, error) { + return strconv.ParseUint(in, 10, 64) +} + +func New(cfg *bridge.Config) bridge.Bridger { + b := &Bharmony{ + Config: cfg, + profileCache: map[uint64]cachedProfile{}, + } + + return b +} + +func (b *Bharmony) getProfile(u uint64) (*profilev1.GetProfileResponse, error) { + if v, ok := b.profileCache[u]; ok && time.Since(v.lastUpdated) < time.Minute*10 { + return v.data, nil + } + + resp, err := b.c.ProfileKit.GetProfile(&profilev1.GetProfileRequest{ + UserId: u, + }) + if err != nil { + if v, ok := b.profileCache[u]; ok { + return v.data, nil + } + return nil, err + } + b.profileCache[u] = cachedProfile{ + data: resp, + lastUpdated: time.Now(), + } + return resp, nil +} + +func (b *Bharmony) avatarFor(m *chatv1.Message) string { + if m.Overrides != nil { + return m.Overrides.GetAvatar() + } + + profi, err := b.getProfile(m.AuthorId) + if err != nil { + return "" + } + + return b.c.TransformHMCURL(profi.Profile.GetUserAvatar()) +} + +func (b *Bharmony) usernameFor(m *chatv1.Message) string { + if m.Overrides != nil { + return m.Overrides.GetUsername() + } + + profi, err := b.getProfile(m.AuthorId) + if err != nil { + return "" + } + + return profi.Profile.UserName +} + +func (b *Bharmony) toMessage(msg *shibshib.LocatedMessage) config.Message { + message := config.Message{} + message.Account = b.Account + message.UserID = uToStr(msg.Message.AuthorId) + message.Avatar = b.avatarFor(msg.Message) + message.Username = b.usernameFor(msg.Message) + message.Channel = uToStr(msg.ChannelID) + message.ID = uToStr(msg.MessageId) + + switch content := msg.Message.Content.Content.(type) { + case *chatv1.Content_EmbedMessage: + message.Text = "Embed" + case *chatv1.Content_AttachmentMessage: + var s strings.Builder + for idx, attach := range content.AttachmentMessage.Files { + s.WriteString(b.c.TransformHMCURL(attach.Id)) + if idx < len(content.AttachmentMessage.Files)-1 { + s.WriteString(", ") + } + } + message.Text = s.String() + case *chatv1.Content_PhotoMessage: + var s strings.Builder + for idx, attach := range content.PhotoMessage.GetPhotos() { + s.WriteString(attach.GetCaption().GetText()) + s.WriteString("\n") + s.WriteString(b.c.TransformHMCURL(attach.GetHmc())) + if idx < len(content.PhotoMessage.GetPhotos())-1 { + s.WriteString("\n\n") + } + } + message.Text = s.String() + case *chatv1.Content_TextMessage: + message.Text = content.TextMessage.Content.Text + } + + return message +} + +func (b *Bharmony) outputMessages() { + for { + msg := <-b.c.EventsStream() + + if msg.Message.AuthorId == b.c.UserID { + continue + } + + b.Remote <- b.toMessage(msg) + } +} + +func (b *Bharmony) GetUint64(conf string) uint64 { + num, err := strToU(b.GetString(conf)) + if err != nil { + log.Fatal(err) + } + + return num +} + +func (b *Bharmony) Connect() (err error) { + b.c, err = shibshib.NewClient(b.GetString("Homeserver"), b.GetString("Token"), b.GetUint64("UserID")) + if err != nil { + return + } + b.c.SubscribeToGuild(b.GetUint64("Community")) + + go b.outputMessages() + + return nil +} + +func (b *Bharmony) send(msg config.Message) (id string, err error) { + msgChan, err := strToU(msg.Channel) + if err != nil { + return + } + + retID, err := b.c.ChatKit.SendMessage(&chatv1.SendMessageRequest{ + GuildId: b.GetUint64("Community"), + ChannelId: msgChan, + Content: &chatv1.Content{ + Content: &chatv1.Content_TextMessage{ + TextMessage: &chatv1.Content_TextContent{ + Content: &chatv1.FormattedText{ + Text: msg.Text, + }, + }, + }, + }, + Overrides: &chatv1.Overrides{ + Username: &msg.Username, + Avatar: &msg.Avatar, + Reason: &chatv1.Overrides_Bridge{Bridge: &typesv1.Empty{}}, + }, + InReplyTo: nil, + EchoId: nil, + Metadata: nil, + }) + if err != nil { + err = fmt.Errorf("send: error sending message: %w", err) + log.Println(err.Error()) + } + + return uToStr(retID.MessageId), err +} + +func (b *Bharmony) delete(msg config.Message) (id string, err error) { + msgChan, err := strToU(msg.Channel) + if err != nil { + return "", err + } + + msgID, err := strToU(msg.ID) + if err != nil { + return "", err + } + + _, err = b.c.ChatKit.DeleteMessage(&chatv1.DeleteMessageRequest{ + GuildId: b.GetUint64("Community"), + ChannelId: msgChan, + MessageId: msgID, + }) + return "", err +} + +func (b *Bharmony) typing(msg config.Message) (id string, err error) { + msgChan, err := strToU(msg.Channel) + if err != nil { + return "", err + } + + _, err = b.c.ChatKit.Typing(&chatv1.TypingRequest{ + GuildId: b.GetUint64("Community"), + ChannelId: msgChan, + }) + return "", err +} + +func (b *Bharmony) Send(msg config.Message) (id string, err error) { + switch msg.Event { + case "": + return b.send(msg) + case config.EventMsgDelete: + return b.delete(msg) + case config.EventUserTyping: + return b.typing(msg) + default: + return "", nil + } +} + +func (b *Bharmony) JoinChannel(channel config.ChannelInfo) error { + return nil +} + +func (b *Bharmony) Disconnect() error { + return nil +} diff --git a/gateway/bridgemap/bharmony.go b/gateway/bridgemap/bharmony.go new file mode 100644 index 0000000..a747dda --- /dev/null +++ b/gateway/bridgemap/bharmony.go @@ -00 +112 @@ +//go:build !noharmony +// +build !noharmony + +package bridgemap + +import ( + bharmony "github.com/42wim/matterbridge/bridge/harmony" +) + +func init() { + FullMap["harmony"] = bharmony.New +} diff --git a/go.mod b/go.mod index 71a0b5f..c17b9a3 100644 --- a/go.mod +++ b/go.mod @@ -156 +157 @@ require (   github.com/google/gops v0.3.22   github.com/gorilla/schema v1.2.0   github.com/gorilla/websocket v1.4.2 + github.com/harmony-development/shibshib v0.0.0-20211127182844-512296f7c548   github.com/hashicorp/golang-lru v0.5.4   github.com/jpillora/backoff v1.0.0   github.com/keybase/go-keybase-chat-bot v0.0.0-20211201215354-ee4b23828b55 diff --git a/go.sum b/go.sum index 328204d..3b85b89 100644 --- a/go.sum +++ b/go.sum @@ -1256 +1257 @@ github.com/advancedlogic/GoOse v0.0.0-20191112112754-e742535969c1/go.mod h1:f3HC  github.com/advancedlogic/GoOse v0.0.0-20200830213114-1225d531e0ad/go.mod h1:f3HCSN1fBWjcpGtXyM119MJgeQl838v6so/PQOqvE1w=  github.com/advancedlogic/GoOse v0.0.0-20210820140952-9d5822d4a625/go.mod h1:f3HCSN1fBWjcpGtXyM119MJgeQl838v6so/PQOqvE1w=  github.com/ajg/form v1.5.1/go.mod h1:uL1WgH+h2mgNtvBq0339dVnzXdBETtL2LeUXaIv25UY= +github.com/alecthomas/repr v0.0.0-20210801044451-80ca428c5142/go.mod h1:2kn6fqh/zIyPLmm3ugklbEi5hg5wS435eygvNfaDQL8=  github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=  github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc=  github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= @@ -1326 +1337 @@ github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRF  github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=  github.com/alexcesaro/log v0.0.0-20150915221235-61e686294e58/go.mod h1:YNfsMyWSs+h+PaYkxGeMVmVCX75Zj/pqdjbu12ciCYE=  github.com/andybalholm/brotli v1.0.0/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y= +github.com/andybalholm/brotli v1.0.2/go.mod h1:loMXtMfwqflxFJPmdbJO0a3KNoPuLBgiu3qAvBg8x/Y=  github.com/andybalholm/brotli v1.0.3/go.mod h1:fO7iG3H7G2nSZ7m0zPUDn85XEX2GTukHGRSepvi9Eig=  github.com/andybalholm/cascadia v1.0.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y=  github.com/andybalholm/cascadia v1.1.0/go.mod h1:GsXiBklL0woXo1j/WYWtSYYC4ouU9PqHO0sqidkEA4Y= @@ -3326 +3348 @@ github.com/facebookgo/ensure v0.0.0-20200202191622-63f1cf65ac4c/go.mod h1:Yg+htX  github.com/facebookgo/stack v0.0.0-20160209184415-751773369052/go.mod h1:UbMTZqLaRiH3MsBH8va0n7s1pQYcu3uTb8G4tygF4Zg=  github.com/facebookgo/subset v0.0.0-20200203212716-c811ad88dec4/go.mod h1:5tD+neXqOorC30/tWg0LCSkrqj/AR6gu8yY8/fpw1q0=  github.com/fasthttp-contrib/websocket v0.0.0-20160511215533-1f3b11f56072/go.mod h1:duJ4Jxv5lDcvg4QuQr0oowTf7dz4/CR8NtyCooz9HL8= +github.com/fasthttp/websocket v1.4.3-rc.9/go.mod h1:eXL2zqDbexYJxaCw8/PQlm7VcMK6uoGvwbYbTdt4dFo= +github.com/fasthttp/websocket v1.4.3-rc.10/go.mod h1:xU7SHrziVFuFx3IO24nLKcu4tm3QykCFXhwtwRk9Xd0=  github.com/fatih/color v1.7.0/go.mod h1:Zm6kSWBoL9eyXnKyktHP6abPY2pDugNf5KwzbycvMj4=  github.com/fatih/color v1.9.0/go.mod h1:eQcE1qtQxscV5RaZvpXrrb8Drkc3/DdQ+uUYCNjL+zU=  github.com/fatih/color v1.12.0/go.mod h1:ELkj/draVOlAH/xkhN6mQ50Qd0MPOk5AAr3maGEBuJM= @@ -4296 +4338 @@ github.com/gocql/gocql v0.0.0-20190301043612-f6df8288f9b4/go.mod h1:4Fw1eo5iaEhD  github.com/godbus/dbus/v5 v5.0.4/go.mod h1:xhWf0FNVPg57R7Z0UbKHbJfkEywrmjJnf7w5xrFpKfA=  github.com/gofrs/uuid v3.2.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM=  github.com/gofrs/uuid v4.0.0+incompatible/go.mod h1:b2aQJv3Z4Fp6yNu3cdSllBxTCLRxnplIgP/c0N/04lM= +github.com/gofiber/fiber/v2 v2.20.1/go.mod h1:/LdZHMUXZvTTo7gU4+b1hclqCAdoQphNQ9bi9gutPyI= +github.com/gofiber/websocket/v2 v2.0.12/go.mod h1:lQRy0u5ACJfiez/e/bhGeYvM0/M940Y3NFw14U3/otI=  github.com/gogo/protobuf v1.1.1/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=  github.com/gogo/protobuf v1.2.0/go.mod h1:r8qH/GZQm5c6nD/R0oafs1akxWv10x8SbQlK7atdtwQ=  github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4= @@ -5706 +5769 @@ github.com/grpc-ecosystem/grpc-gateway v1.16.0/go.mod h1:BDjrQk3hbvj6Nolgz8mAMFb  github.com/h2non/go-is-svg v0.0.0-20160927212452-35e8c4b0612c/go.mod h1:ObS/W+h8RYb1Y7fYivughjxojTmIu5iAIjSrSLCLeqE=  github.com/hailocab/go-hostpool v0.0.0-20160125115350-e80d13ce29ed/go.mod h1:tMWxXQ9wFIaZeTI9F+hmhFiGpFmhOHzyShyFUhRm0H4=  github.com/hako/durafmt v0.0.0-20210608085754-5c1018a4e16b/go.mod h1:VzxiSdG6j1pi7rwGm/xYI5RbtpBgM8sARDXlvEvxlu0= +github.com/harmony-development/hrpc v0.0.0-20211020182021-788fc204a0fe/go.mod h1:B+5b0+n0UpMtqAGtJ2oYlgsArI9LbSJ0/HoySJNzDFY= +github.com/harmony-development/shibshib v0.0.0-20211127182844-512296f7c548 h1:jAnKjA+wco4ONGpCtINd0t+sC+ffF+yYScGqgJ2OG4o= +github.com/harmony-development/shibshib v0.0.0-20211127182844-512296f7c548/go.mod h1:e3LPbk9jFYwu72EVyGPJC7CKBBSmxb4ZdyJalaaskdc=  github.com/hashicorp/consul/api v1.1.0/go.mod h1:VmuI/Lkw1nC05EYQWNKwWGbkg+FbDBtguAZLlVdkD9Q=  github.com/hashicorp/consul/api v1.10.1/go.mod h1:XjsvQN+RJGWI2TWy1/kqaE16HrR2J/FWgkYjdZQsX9M=  github.com/hashicorp/consul/sdk v0.1.1/go.mod h1:VKf9jXwCTEY1QZP2MOLRhb5i/I/ssyNV1vwHyQBF0x8= @@ -7426 +7517 @@ github.com/klauspost/compress v1.10.10/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdY  github.com/klauspost/compress v1.11.13/go.mod h1:aoV0uJVorq1K+umq18yTdKaF57EivdYsUV+/s2qKfXs=  github.com/klauspost/compress v1.12.2/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=  github.com/klauspost/compress v1.13.1/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg= +github.com/klauspost/compress v1.13.4/go.mod h1:8dP1Hq4DHOhN9w426knH3Rhby4rFm6D8eO+e+Dq5Gzg=  github.com/klauspost/compress v1.13.6/go.mod h1:/3/Vjq9QcHkK5uEr5lBEmyoZ1iFhe47etQ6QUkpK6sk=  github.com/klauspost/cpuid v1.2.0/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek=  github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= @@ -8146 +82410 @@ github.com/matterbridge/discordgo v0.21.2-0.20210201201054-fb39a175b4f7 h1:4J2YZ  github.com/matterbridge/discordgo v0.21.2-0.20210201201054-fb39a175b4f7/go.mod h1:411nZYv0UMMrtppR5glXop1foboJiFAowy+42U+Ahvw=  github.com/matterbridge/go-xmpp v0.0.0-20211030125215-791a06c5f1be h1:zlirT+LngOJ60G6FVzI87DljGZLUnfNzmXja61EjtYM=  github.com/matterbridge/go-xmpp v0.0.0-20211030125215-791a06c5f1be/go.mod h1:ECDRehsR9TYTKCAsRS8/wLeOk6UUqDydw47ln7wG41Q= +github.com/matterbridge/go-xmpp v0.0.0-20180131083630-7ec2b8b7def6 h1:GDh7egrbDEzP41mScMt7Q/uPM2nJENh9LNFXjUOGts8= +github.com/matterbridge/go-xmpp v0.0.0-20180131083630-7ec2b8b7def6/go.mod h1:ECDRehsR9TYTKCAsRS8/wLeOk6UUqDydw47ln7wG41Q= +github.com/matterbridge/go-xmpp v0.0.0-20210731150933-5702291c239f h1:1hfavl4YOoRjgTBWezeX8WXCGnhrxnfEgQtb38wQnyg= +github.com/matterbridge/go-xmpp v0.0.0-20210731150933-5702291c239f/go.mod h1:ECDRehsR9TYTKCAsRS8/wLeOk6UUqDydw47ln7wG41Q=  github.com/matterbridge/gozulipbot v0.0.0-20211023205727-a19d6c1f3b75 h1:GslZKF7lW7oSisycGLpxPO+TnKJuA4VZuTWIfYZrClc=  github.com/matterbridge/gozulipbot v0.0.0-20211023205727-a19d6c1f3b75/go.mod h1:yAjnZ34DuDyPHMPHHjOsTk/FefW4JJjoMMCGt/8uuQA=  github.com/matterbridge/logrus-prefixed-formatter v0.5.3-0.20200523233437-d971309a77ba h1:XleOY4IjAEIcxAh+IFwT5JT5Ze3RHiYz6m+4ZfZ0rc0= @@ -8726 +8868 @@ github.com/mattn/go-sqlite3 v1.9.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOq  github.com/mattn/go-sqlite3 v1.10.0/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc=  github.com/mattn/go-sqlite3 v1.14.6/go.mod h1:NyWgC/yNuGj7Q9rpYnZvas74GogHl5/Z4A/KQRfk6bU=  github.com/mattn/go-sqlite3 v2.0.3+incompatible/go.mod h1:FPy6KqzDD04eiIsT53CuJW3U88zkxoIYsOqkbpncsNc= +github.com/mattn/go-xmpp v0.0.0-20211029151415-912ba614897a h1:BRuMO9LUDuGp6viOhrEbmuXNlvC78X5QdsnY9Wc+cqM= +github.com/mattn/go-xmpp v0.0.0-20211029151415-912ba614897a/go.mod h1:Cs5mF0OsrRRmhkyOod//ldNPOwJsrBvJ+1WRspv0xoc=  github.com/mattn/godown v0.0.1 h1:39uk50ufLVQFs0eapIJVX5fCS74a1Fs2g5f1MVqIHdE=  github.com/mattn/godown v0.0.1/go.mod h1:/ivCKurgV/bx6yqtP/Jtc2Xmrv3beCYBvlfAUl4X5g4=  github.com/mattn/goveralls v0.0.2/go.mod h1:8d1ZMHsd7fW6IRPKQh46F2WRpyib5/X4FOpevwGNQEw= @@ -11086 +11247 @@ github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca h1:NugYot0LIVPxT  github.com/saintfish/chardet v0.0.0-20120816061221-3af4cd4741ca/go.mod h1:uugorj2VCxiV1x+LzaIdVa9b4S4qGAcH6cbhh4qVxOU=  github.com/satori/go.uuid v0.0.0-20180103174451-36e9d2ebbde5/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0=  github.com/satori/go.uuid v1.2.0/go.mod h1:dA0hQrYB0VpLJoorglMZABFdXlWrHn1NEOzdhQKdks0= +github.com/savsgio/gotils v0.0.0-20210921075833-21a6215cb0e4/go.mod h1:oejLrk1Y/5zOF+c/aHtXqn3TFlzzbAgPWg8zBiAHDas=  github.com/schollz/closestmatch v2.1.0+incompatible/go.mod h1:RtP1ddjLong6gTkbtmuhtR2uUrrJOpYzYRvbcPAid+g=  github.com/sclevine/agouti v3.0.0+incompatible/go.mod h1:b4WX9W9L1sfQKXeJf1mUTLZKJ48R1S7H23Ji7oFO5Bw=  github.com/scylladb/termtables v0.0.0-20191203121021-c4c0b6d42ff4/go.mod h1:C1a7PQSMz9NShzorzCiG2fk9+xuCgLkPeCvMHYR2OWg= @@ -126010 +127714 @@ github.com/urfave/negroni v1.0.0/go.mod h1:Meg73S6kFm/4PpbYdq35yYWoCZ9mS/YSx+lKn  github.com/valyala/bytebufferpool v1.0.0 h1:GqA5TC/0021Y/b9FG4Oi9Mr3q7XYx6KllzawFIhcdPw=  github.com/valyala/bytebufferpool v1.0.0/go.mod h1:6bBcMArwyJ5K/AmCkWv1jt77kVWyCJ6HpOuEn7z0Csc=  github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBnvPM1Su9w= +github.com/valyala/fasthttp v1.29.0/go.mod h1:2rsYD01CKFrjjsvFxx75KlEUNpWNBY9JWD3K/7o2Cus= +github.com/valyala/fasthttp v1.30.0/go.mod h1:2rsYD01CKFrjjsvFxx75KlEUNpWNBY9JWD3K/7o2Cus= +github.com/valyala/fasthttp v1.31.0/go.mod h1:2rsYD01CKFrjjsvFxx75KlEUNpWNBY9JWD3K/7o2Cus=  github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8=  github.com/valyala/fasttemplate v1.2.1 h1:TVEnxayobAdVkhQfrfes2IzOB6o+z4roRkPF52WA1u4=  github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ=  github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= +github.com/valyala/tcplisten v1.0.0/go.mod h1:T0xQ8SeCZGxckz9qRXTfG43PvQ/mcWh7FwZEA7Ioqkc=  github.com/viant/assertly v0.4.8/go.mod h1:aGifi++jvCrUaklKEKT0BU95igDNaqkvz+49uaYMPRU=  github.com/viant/toolbox v0.24.0/go.mod h1:OxMCG57V0PXuIP2HNQrtJf2CjqdmbrOx5EkMILuUhzM=  github.com/vincent-petithory/dataurl v1.0.0 h1:cXw+kPto8NLuJtlMsI152irrVw9fRDX8AbShPRpg2CI= @@ -15116 +15327 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT  golang.org/x/net v0.0.0-20210503060351-7fd8e65b6420/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=  golang.org/x/net v0.0.0-20210520170846-37e1c6afe023/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=  golang.org/x/net v0.0.0-20210525063256-abc453219eb5/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20210510120150-4163338589ed/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=  golang.org/x/net v0.0.0-20210614182718-04defd469f4e/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=  golang.org/x/net v0.0.0-20210805182204-aaa1db679c0d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=  golang.org/x/net v0.0.0-20210813160813-60bc85c4be6d/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= @@ -16556 +16778 @@ golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBc  golang.org/x/sys v0.0.0-20211006225509-1a26e0398eed h1:E159xujlywdAeN3FqsTBPzRKGUq/pDHolXbuttkC36E=  golang.org/x/sys v0.0.0-20211006225509-1a26e0398eed/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=  golang.org/x/term v0.0.0-20201117132131-f5c789dd3221/go.mod h1:Nr5EML6q2oocZ2LXRh80K7BxOlk5/8JxuGnuhpl+muw= +golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac h1:oN6lz7iLW/YC7un8pq+9bOLyXrprv2+DKfkJY+2LJJw= +golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=  golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E=  golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=  golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/matterbridge.toml.sample b/matterbridge.toml.sample index d9210f4..150e0d8 100644 --- a/matterbridge.toml.sample +++ b/matterbridge.toml.sample @@ -16606 +166018 @@ StripNick=false  #OPTIONAL (default false)  ShowTopicChange=false   +################################################################### +# Harmony +################################################################### + +[harmony.chat_harmonyapp_io] +Homeserver = "https://chat.harmonyapp.io:2289" +Token = "your token goes here" +UserID = "user id of the bot account" +Community = "community id that channels will be located in" +UseUserName = true +RemoteNickFormat = "{NICK}" +  ###################################################################  #API  ################################################################### @@ -19536 +196510 @@ enable=true account="zulip.streamchat" channel="general/topic:mytopic"   + [[gateway.inout]] + account="harmony.chat_harmonyapp_io" + channel="channel id goes here" + #API example #[[gateway.inout]] #account="api.local"