mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-06-26 21:19:22 +00:00
Compare commits
13 Commits
Author | SHA1 | Date | |
---|---|---|---|
822605c157 | |||
e49266ae43 | |||
62e9de1a3b | |||
2ddc4f7ae9 | |||
2dd402675d | |||
25b1af1e11 | |||
75fb2b8156 | |||
2a403f8b85 | |||
c3d45a9f06 | |||
c07b85b625 | |||
511f653e6e | |||
5636eaca6d | |||
4b839b9958 |
@ -42,7 +42,7 @@ Accounts to one of the supported bridges
|
||||
# Installing
|
||||
## Binaries
|
||||
Binaries can be found [here] (https://github.com/42wim/matterbridge/releases/)
|
||||
* Latest stable release [v0.14.0](https://github.com/42wim/matterbridge/releases/latest)
|
||||
* Latest stable release [v0.15.0](https://github.com/42wim/matterbridge/releases/latest)
|
||||
|
||||
## Building
|
||||
Go 1.6+ 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)
|
||||
|
@ -21,6 +21,7 @@ type Api struct {
|
||||
type ApiMessage struct {
|
||||
Text string `json:"text"`
|
||||
Username string `json:"username"`
|
||||
UserID string `json:"userid"`
|
||||
Avatar string `json:"avatar"`
|
||||
Gateway string `json:"gateway"`
|
||||
}
|
||||
@ -81,6 +82,7 @@ func (b *Api) handlePostMessage(c echo.Context) error {
|
||||
b.Remote <- config.Message{
|
||||
Text: message.Text,
|
||||
Username: message.Username,
|
||||
UserID: message.UserID,
|
||||
Channel: "api",
|
||||
Avatar: message.Avatar,
|
||||
Account: b.Account,
|
||||
|
@ -19,6 +19,7 @@ type Message struct {
|
||||
Text string `json:"text"`
|
||||
Channel string `json:"channel"`
|
||||
Username string `json:"username"`
|
||||
UserID string `json:"userid"` // userid on the bridge
|
||||
Avatar string `json:"avatar"`
|
||||
Account string `json:"account"`
|
||||
Event string `json:"event"`
|
||||
@ -44,6 +45,7 @@ type Protocol struct {
|
||||
EditDisable bool // mattermost, slack, discord, telegram, gitter
|
||||
IconURL string // mattermost, slack
|
||||
IgnoreNicks string // all protocols
|
||||
IgnoreMessages string // all protocols
|
||||
Jid string // xmpp
|
||||
Login string // mattermost, matrix
|
||||
Muc string // xmpp
|
||||
|
@ -142,7 +142,8 @@ func (b *bdiscord) messageCreate(s *discordgo.Session, m *discordgo.MessageCreat
|
||||
m.Message.Content = b.stripCustomoji(m.Message.Content)
|
||||
m.Message.Content = b.replaceChannelMentions(m.Message.Content)
|
||||
b.Remote <- config.Message{Username: username, Text: m.ContentWithMentionsReplaced(), Channel: channelName,
|
||||
Account: b.Account, Avatar: "https://cdn.discordapp.com/avatars/" + m.Author.ID + "/" + m.Author.Avatar + ".jpg"}
|
||||
Account: b.Account, Avatar: "https://cdn.discordapp.com/avatars/" + m.Author.ID + "/" + m.Author.Avatar + ".jpg",
|
||||
UserID: m.Author.ID}
|
||||
}
|
||||
|
||||
func (b *bdiscord) memberUpdate(s *discordgo.Session, m *discordgo.GuildMemberUpdate) {
|
||||
@ -169,10 +170,11 @@ func (b *bdiscord) getNick(user *discordgo.User) string {
|
||||
}
|
||||
}
|
||||
// if we didn't find nick, search for it
|
||||
b.userMemberMap[user.ID], err = b.c.GuildMember(b.guildID, user.ID)
|
||||
member, err := b.c.GuildMember(b.guildID, user.ID)
|
||||
if err != nil {
|
||||
return user.Username
|
||||
}
|
||||
b.userMemberMap[user.ID] = member
|
||||
// only return if nick is set
|
||||
if b.userMemberMap[user.ID].Nick != "" {
|
||||
return b.userMemberMap[user.ID].Nick
|
||||
|
@ -82,7 +82,7 @@ func (b *Bgitter) JoinChannel(channel string) error {
|
||||
if !strings.HasSuffix(ev.Message.Text, "") {
|
||||
flog.Debugf("Sending message from %s on %s to gateway", ev.Message.From.Username, b.Account)
|
||||
b.Remote <- config.Message{Username: ev.Message.From.Username, Text: ev.Message.Text, Channel: room,
|
||||
Account: b.Account, Avatar: b.getAvatar(ev.Message.From.Username)}
|
||||
Account: b.Account, Avatar: b.getAvatar(ev.Message.From.Username), UserID: ev.Message.From.ID}
|
||||
}
|
||||
case *gitter.GitterConnectionClosed:
|
||||
flog.Errorf("connection with gitter closed for room %s", room)
|
||||
|
@ -23,6 +23,7 @@ type Birc struct {
|
||||
connected chan struct{}
|
||||
Local chan config.Message // local queue for flood control
|
||||
Account string
|
||||
FirstConnection bool
|
||||
}
|
||||
|
||||
var flog *log.Entry
|
||||
@ -49,6 +50,7 @@ func New(cfg config.Protocol, account string, c chan config.Message) *Birc {
|
||||
if b.Config.MessageLength == 0 {
|
||||
b.Config.MessageLength = 400
|
||||
}
|
||||
b.FirstConnection = true
|
||||
return b
|
||||
}
|
||||
|
||||
@ -74,6 +76,8 @@ func (b *Birc) Connect() error {
|
||||
i.SASLLogin = b.Config.NickServNick
|
||||
i.SASLPassword = b.Config.NickServPassword
|
||||
i.TLSConfig = &tls.Config{InsecureSkipVerify: b.Config.SkipTLSVerify}
|
||||
i.KeepAlive = time.Minute
|
||||
i.PingFreq = time.Minute
|
||||
if b.Config.Password != "" {
|
||||
i.Password = b.Config.Password
|
||||
}
|
||||
@ -90,6 +94,14 @@ func (b *Birc) Connect() error {
|
||||
return fmt.Errorf("connection timed out")
|
||||
}
|
||||
i.Debug = false
|
||||
// clear on reconnects
|
||||
i.ClearCallback(ircm.RPL_WELCOME)
|
||||
i.AddCallback(ircm.RPL_WELCOME, func(event *irc.Event) {
|
||||
b.Remote <- config.Message{Username: "system", Text: "rejoin", Channel: "", Account: b.Account, Event: config.EVENT_REJOIN_CHANNELS}
|
||||
// set our correct nick on reconnect if necessary
|
||||
b.Nick = event.Nick
|
||||
})
|
||||
go i.Loop()
|
||||
go b.doSend()
|
||||
return nil
|
||||
}
|
||||
@ -192,8 +204,11 @@ func (b *Birc) handleJoinPart(event *irc.Event) {
|
||||
return
|
||||
}
|
||||
}
|
||||
if event.Nick != b.Nick {
|
||||
flog.Debugf("Sending JOIN_LEAVE event from %s to gateway", b.Account)
|
||||
b.Remote <- config.Message{Username: "system", Text: event.Nick + " " + strings.ToLower(event.Code) + "s", Channel: channel, Account: b.Account, Event: config.EVENT_JOIN_LEAVE}
|
||||
return
|
||||
}
|
||||
flog.Debugf("handle %#v", event)
|
||||
}
|
||||
|
||||
@ -214,6 +229,11 @@ func (b *Birc) handleOther(event *irc.Event) {
|
||||
}
|
||||
|
||||
func (b *Birc) handlePrivMsg(event *irc.Event) {
|
||||
b.Nick = b.i.GetNick()
|
||||
// freenode doesn't send 001 as first reply
|
||||
if event.Code == "NOTICE" {
|
||||
return
|
||||
}
|
||||
// don't forward queries to the bot
|
||||
if event.Arguments[0] == b.Nick {
|
||||
return
|
||||
@ -232,7 +252,7 @@ func (b *Birc) handlePrivMsg(event *irc.Event) {
|
||||
re := regexp.MustCompile(`[[:cntrl:]](\d+,|)\d+`)
|
||||
msg = re.ReplaceAllString(msg, "")
|
||||
flog.Debugf("Sending message from %s on %s to gateway", event.Arguments[0], b.Account)
|
||||
b.Remote <- config.Message{Username: event.Nick, Text: msg, Channel: event.Arguments[0], Account: b.Account}
|
||||
b.Remote <- config.Message{Username: event.Nick, Text: msg, Channel: event.Arguments[0], Account: b.Account, UserID: event.User + "@" + event.Host}
|
||||
}
|
||||
|
||||
func (b *Birc) handleTopicWhoTime(event *irc.Event) {
|
||||
|
@ -109,7 +109,7 @@ func (b *Bmatrix) handlematrix() error {
|
||||
username = re.ReplaceAllString(username, `$1`)
|
||||
}
|
||||
flog.Debugf("Sending message from %s on %s to gateway", ev.Sender, b.Account)
|
||||
b.Remote <- config.Message{Username: username, Text: ev.Content["body"].(string), Channel: channel, Account: b.Account}
|
||||
b.Remote <- config.Message{Username: username, Text: ev.Content["body"].(string), Channel: channel, Account: b.Account, UserID: ev.Sender}
|
||||
}
|
||||
flog.Debugf("Received: %#v", ev)
|
||||
})
|
||||
|
@ -21,6 +21,7 @@ type MMMessage struct {
|
||||
Text string
|
||||
Channel string
|
||||
Username string
|
||||
UserID string
|
||||
}
|
||||
|
||||
type Bmattermost struct {
|
||||
@ -127,7 +128,7 @@ func (b *Bmattermost) handleMatter() {
|
||||
}
|
||||
for message := range mchan {
|
||||
flog.Debugf("Sending message from %s on %s to gateway", message.Username, b.Account)
|
||||
b.Remote <- config.Message{Text: message.Text, Username: message.Username, Channel: message.Channel, Account: b.Account}
|
||||
b.Remote <- config.Message{Text: message.Text, Username: message.Username, Channel: message.Channel, Account: b.Account, UserID: message.UserID}
|
||||
}
|
||||
}
|
||||
|
||||
@ -141,12 +142,16 @@ func (b *Bmattermost) handleMatterClient(mchan chan *MMMessage) {
|
||||
b.Remote <- config.Message{Username: "system", Text: message.Text, Channel: message.Channel, Account: b.Account, Event: config.EVENT_JOIN_LEAVE}
|
||||
continue
|
||||
}
|
||||
if (message.Raw.Event == "post_edited") && b.Config.EditDisable {
|
||||
continue
|
||||
}
|
||||
// do not post our own messages back to irc
|
||||
// only listen to message from our team
|
||||
if (message.Raw.Event == "posted" || message.Raw.Event == "post_edited") &&
|
||||
b.mc.User.Username != message.Username && message.Raw.Data["team_id"].(string) == b.TeamId {
|
||||
flog.Debugf("Receiving from matterclient %#v", message)
|
||||
m := &MMMessage{}
|
||||
m.UserID = message.UserID
|
||||
m.Username = message.Username
|
||||
m.Channel = message.Channel
|
||||
m.Text = message.Text
|
||||
@ -168,6 +173,7 @@ func (b *Bmattermost) handleMatterHook(mchan chan *MMMessage) {
|
||||
message := b.mh.Receive()
|
||||
flog.Debugf("Receiving from matterhook %#v", message)
|
||||
m := &MMMessage{}
|
||||
m.UserID = message.UserID
|
||||
m.Username = message.UserName
|
||||
m.Text = message.Text
|
||||
m.Channel = message.ChannelName
|
||||
|
@ -82,6 +82,6 @@ func (b *Brocketchat) handleRocketHook() {
|
||||
continue
|
||||
}
|
||||
flog.Debugf("Sending message from %s on %s to gateway", message.UserName, b.Account)
|
||||
b.Remote <- config.Message{Text: message.Text, Username: message.UserName, Channel: message.ChannelName, Account: b.Account}
|
||||
b.Remote <- config.Message{Text: message.Text, Username: message.UserName, Channel: message.ChannelName, Account: b.Account, UserID: message.UserID}
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@ type MMMessage struct {
|
||||
Text string
|
||||
Channel string
|
||||
Username string
|
||||
UserID string
|
||||
Raw *slack.MessageEvent
|
||||
}
|
||||
|
||||
@ -185,7 +186,7 @@ func (b *Bslack) handleSlack() {
|
||||
texts := strings.Split(message.Text, "\n")
|
||||
for _, text := range texts {
|
||||
flog.Debugf("Sending message from %s on %s to gateway", message.Username, b.Account)
|
||||
b.Remote <- config.Message{Text: text, Username: message.Username, Channel: message.Channel, Account: b.Account, Avatar: b.getAvatar(message.Username)}
|
||||
b.Remote <- config.Message{Text: text, Username: message.Username, Channel: message.Channel, Account: b.Account, Avatar: b.getAvatar(message.Username), UserID: message.UserID}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -213,6 +214,7 @@ func (b *Bslack) handleSlackClient(mchan chan *MMMessage) {
|
||||
continue
|
||||
}
|
||||
m := &MMMessage{}
|
||||
m.UserID = user.ID
|
||||
m.Username = user.Name
|
||||
m.Channel = channel.Name
|
||||
m.Text = ev.Text
|
||||
|
@ -114,9 +114,31 @@ func (b *Btelegram) handleRecv(updates <-chan tgbotapi.Update) {
|
||||
if username == "" {
|
||||
username = "unknown"
|
||||
}
|
||||
if message.Sticker != nil {
|
||||
text = text + " " + b.getFileDirectURL(message.Sticker.FileID)
|
||||
}
|
||||
if message.Video != nil {
|
||||
text = text + " " + b.getFileDirectURL(message.Video.FileID)
|
||||
}
|
||||
if message.Photo != nil {
|
||||
photos := *message.Photo
|
||||
// last photo is the biggest
|
||||
text = text + " " + b.getFileDirectURL(photos[len(photos)-1].FileID)
|
||||
}
|
||||
if message.Document != nil {
|
||||
text = text + " " + message.Document.FileName + " : " + b.getFileDirectURL(message.Document.FileID)
|
||||
}
|
||||
if text != "" {
|
||||
flog.Debugf("Sending message from %s on %s to gateway", username, b.Account)
|
||||
b.Remote <- config.Message{Username: username, Text: text, Channel: channel, Account: b.Account}
|
||||
b.Remote <- config.Message{Username: username, Text: text, Channel: channel, Account: b.Account, UserID: strconv.Itoa(message.From.ID)}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (b *Btelegram) getFileDirectURL(id string) string {
|
||||
res, err := b.c.GetFileDirectURL(id)
|
||||
if err != nil {
|
||||
return ""
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ func (b *Bxmpp) handleXmpp() error {
|
||||
}
|
||||
if nick != b.Config.Nick && v.Stamp == nodelay && v.Text != "" {
|
||||
flog.Debugf("Sending message from %s on %s to gateway", nick, b.Account)
|
||||
b.Remote <- config.Message{Username: nick, Text: v.Text, Channel: channel, Account: b.Account}
|
||||
b.Remote <- config.Message{Username: nick, Text: v.Text, Channel: channel, Account: b.Account, UserID: v.Remote}
|
||||
}
|
||||
}
|
||||
case xmpp.Presence:
|
||||
|
17
changelog.md
17
changelog.md
@ -1,3 +1,20 @@
|
||||
# v0.15.0
|
||||
## New features
|
||||
* general: add option IgnoreMessages for all protocols (see mattebridge.toml.sample)
|
||||
Messages matching these regexp will be ignored and not sent to other bridges
|
||||
e.g. IgnoreMessages="^~~ badword"
|
||||
* telegram: add support for sticker/video/photo/document #184
|
||||
|
||||
## Changes
|
||||
* api: add userid to each message #200
|
||||
|
||||
## Bugfix
|
||||
* discord: fix crash in memberupdate #198
|
||||
* mattermost: Fix incorrect behaviour of EditDisable (mattermost). Fixes #197
|
||||
* irc: Do not relay join/part of ourselves (irc). Closes #190
|
||||
* irc: make reconnections more robust. #153
|
||||
* gitter: update library, fixes possible crash
|
||||
|
||||
# v0.14.0
|
||||
## New features
|
||||
* api: add token authentication
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"github.com/42wim/matterbridge/bridge"
|
||||
"github.com/42wim/matterbridge/bridge/config"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@ -230,6 +231,20 @@ func (gw *Gateway) ignoreMessage(msg *config.Message) bool {
|
||||
return true
|
||||
}
|
||||
}
|
||||
// TODO do not compile regexps everytime
|
||||
for _, entry := range strings.Fields(gw.Bridges[msg.Account].Config.IgnoreMessages) {
|
||||
if entry != "" {
|
||||
re, err := regexp.Compile(entry)
|
||||
if err != nil {
|
||||
log.Errorf("incorrect regexp %s for %s", entry, msg.Account)
|
||||
continue
|
||||
}
|
||||
if re.MatchString(msg.Text) {
|
||||
log.Debugf("matching %s. ignoring %s from %s", entry, msg.Text, msg.Account)
|
||||
return true
|
||||
}
|
||||
}
|
||||
}
|
||||
return false
|
||||
}
|
||||
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
version = "0.14.0"
|
||||
version = "0.15.0"
|
||||
githash string
|
||||
)
|
||||
|
||||
|
@ -63,6 +63,12 @@ MessageLength=400
|
||||
#OPTIONAL
|
||||
IgnoreNicks="ircspammer1 ircspammer2"
|
||||
|
||||
#Messages you want to ignore.
|
||||
#Messages matching these regexp will be ignored and not sent to other bridges
|
||||
#See https://regex-golang.appspot.com/assets/html/index.html for more regex info
|
||||
#OPTIONAL (example below ignores messages starting with ~~ or messages containing badword
|
||||
IgnoreMessages="^~~ badword"
|
||||
|
||||
#RemoteNickFormat defines how remote users appear on this bridge
|
||||
#The string "{NICK}" (case sensitive) will be replaced by the actual nick / username.
|
||||
#The string "{BRIDGE}" (case sensitive) will be replaced by the sending bridge
|
||||
@ -115,6 +121,12 @@ SkipTLSVerify=true
|
||||
#OPTIONAL
|
||||
IgnoreNicks="ircspammer1 ircspammer2"
|
||||
|
||||
#Messages you want to ignore.
|
||||
#Messages matching these regexp will be ignored and not sent to other bridges
|
||||
#See https://regex-golang.appspot.com/assets/html/index.html for more regex info
|
||||
#OPTIONAL (example below ignores messages starting with ~~ or messages containing badword
|
||||
IgnoreMessages="^~~ badword"
|
||||
|
||||
#RemoteNickFormat defines how remote users appear on this bridge
|
||||
#The string "{NICK}" (case sensitive) will be replaced by the actual nick / username.
|
||||
#The string "{BRIDGE}" (case sensitive) will be replaced by the sending bridge
|
||||
@ -159,6 +171,12 @@ Nick="yourlogin"
|
||||
#OPTIONAL
|
||||
IgnoreNicks="spammer1 spammer2"
|
||||
|
||||
#Messages you want to ignore.
|
||||
#Messages matching these regexp will be ignored and not sent to other bridges
|
||||
#See https://regex-golang.appspot.com/assets/html/index.html for more regex info
|
||||
#OPTIONAL (example below ignores messages starting with ~~ or messages containing badword
|
||||
IgnoreMessages="^~~ badword"
|
||||
|
||||
#RemoteNickFormat defines how remote users appear on this bridge
|
||||
#The string "{NICK}" (case sensitive) will be replaced by the actual nick / username.
|
||||
#The string "{BRIDGE}" (case sensitive) will be replaced by the sending bridge
|
||||
@ -261,6 +279,12 @@ EditSuffix=" (edited)"
|
||||
#OPTIONAL
|
||||
IgnoreNicks="ircspammer1 ircspammer2"
|
||||
|
||||
#Messages you want to ignore.
|
||||
#Messages matching these regexp will be ignored and not sent to other bridges
|
||||
#See https://regex-golang.appspot.com/assets/html/index.html for more regex info
|
||||
#OPTIONAL (example below ignores messages starting with ~~ or messages containing badword
|
||||
IgnoreMessages="^~~ badword"
|
||||
|
||||
#RemoteNickFormat defines how remote users appear on this bridge
|
||||
#The string "{NICK}" (case sensitive) will be replaced by the actual nick / username.
|
||||
#The string "{BRIDGE}" (case sensitive) will be replaced by the sending bridge
|
||||
@ -294,6 +318,12 @@ Token="Yourtokenhere"
|
||||
#OPTIONAL
|
||||
IgnoreNicks="ircspammer1 ircspammer2"
|
||||
|
||||
#Messages you want to ignore.
|
||||
#Messages matching these regexp will be ignored and not sent to other bridges
|
||||
#See https://regex-golang.appspot.com/assets/html/index.html for more regex info
|
||||
#OPTIONAL (example below ignores messages starting with ~~ or messages containing badword
|
||||
IgnoreMessages="^~~ badword"
|
||||
|
||||
#RemoteNickFormat defines how remote users appear on this bridge
|
||||
#The string "{NICK}" (case sensitive) will be replaced by the actual nick / username.
|
||||
#The string "{BRIDGE}" (case sensitive) will be replaced by the sending bridge
|
||||
@ -383,6 +413,12 @@ PrefixMessagesWithNick=false
|
||||
#OPTIONAL
|
||||
IgnoreNicks="ircspammer1 ircspammer2"
|
||||
|
||||
#Messages you want to ignore.
|
||||
#Messages matching these regexp will be ignored and not sent to other bridges
|
||||
#See https://regex-golang.appspot.com/assets/html/index.html for more regex info
|
||||
#OPTIONAL (example below ignores messages starting with ~~ or messages containing badword
|
||||
IgnoreMessages="^~~ badword"
|
||||
|
||||
#RemoteNickFormat defines how remote users appear on this bridge
|
||||
#The string "{NICK}" (case sensitive) will be replaced by the actual nick / username.
|
||||
#The string "{BRIDGE}" (case sensitive) will be replaced by the sending bridge
|
||||
@ -427,6 +463,12 @@ EditSuffix=" (edited)"
|
||||
#OPTIONAL
|
||||
IgnoreNicks="ircspammer1 ircspammer2"
|
||||
|
||||
#Messages you want to ignore.
|
||||
#Messages matching these regexp will be ignored and not sent to other bridges
|
||||
#See https://regex-golang.appspot.com/assets/html/index.html for more regex info
|
||||
#OPTIONAL (example below ignores messages starting with ~~ or messages containing badword
|
||||
IgnoreMessages="^~~ badword"
|
||||
|
||||
#RemoteNickFormat defines how remote users appear on this bridge
|
||||
#The string "{NICK}" (case sensitive) will be replaced by the actual nick / username.
|
||||
#The string "{BRIDGE}" (case sensitive) will be replaced by the sending bridge
|
||||
@ -477,6 +519,12 @@ EditSuffix=" (edited)"
|
||||
#OPTIONAL
|
||||
IgnoreNicks="spammer1 spammer2"
|
||||
|
||||
#Messages you want to ignore.
|
||||
#Messages matching these regexp will be ignored and not sent to other bridges
|
||||
#See https://regex-golang.appspot.com/assets/html/index.html for more regex info
|
||||
#OPTIONAL (example below ignores messages starting with ~~ or messages containing badword
|
||||
IgnoreMessages="^~~ badword"
|
||||
|
||||
#RemoteNickFormat defines how remote users appear on this bridge
|
||||
#The string "{NICK}" (case sensitive) will be replaced by the actual nick / username.
|
||||
#The string "{BRIDGE}" (case sensitive) will be replaced by the sending bridge
|
||||
@ -535,6 +583,12 @@ PrefixMessagesWithNick=false
|
||||
#OPTIONAL
|
||||
IgnoreNicks="ircspammer1 ircspammer2"
|
||||
|
||||
#Messages you want to ignore.
|
||||
#Messages matching these regexp will be ignored and not sent to other bridges
|
||||
#See https://regex-golang.appspot.com/assets/html/index.html for more regex info
|
||||
#OPTIONAL (example below ignores messages starting with ~~ or messages containing badword
|
||||
IgnoreMessages="^~~ badword"
|
||||
|
||||
#RemoteNickFormat defines how remote users appear on this bridge
|
||||
#The string "{NICK}" (case sensitive) will be replaced by the actual nick / username.
|
||||
#The string "{BRIDGE}" (case sensitive) will be replaced by the sending bridge
|
||||
@ -584,6 +638,12 @@ PrefixMessagesWithNick=false
|
||||
#OPTIONAL
|
||||
IgnoreNicks="spammer1 spammer2"
|
||||
|
||||
#Messages you want to ignore.
|
||||
#Messages matching these regexp will be ignored and not sent to other bridges
|
||||
#See https://regex-golang.appspot.com/assets/html/index.html for more regex info
|
||||
#OPTIONAL (example below ignores messages starting with ~~ or messages containing badword
|
||||
IgnoreMessages="^~~ badword"
|
||||
|
||||
#RemoteNickFormat defines how remote users appear on this bridge
|
||||
#The string "{NICK}" (case sensitive) will be replaced by the actual nick / username.
|
||||
#The string "{BRIDGE}" (case sensitive) will be replaced by the sending bridge
|
||||
@ -681,7 +741,7 @@ enable=true
|
||||
#telegram - chatid (a large negative number, eg -123456789)
|
||||
# see (https://www.linkedin.com/pulse/telegram-bots-beginners-marco-frau)
|
||||
#hipchat - id_channel (see https://www.hipchat.com/account/xmpp for the correct channel)
|
||||
#rocketchat - #channel (# is required)
|
||||
#rocketchat - #channel (# is required (also needed for private channels!)
|
||||
#matrix - #channel:server (eg #yourchannel:matrix.org)
|
||||
# - encrypted rooms are not supported in matrix
|
||||
#REQUIRED
|
||||
|
@ -37,6 +37,7 @@ type Message struct {
|
||||
Username string
|
||||
Text string
|
||||
Type string
|
||||
UserID string
|
||||
}
|
||||
|
||||
type Team struct {
|
||||
@ -290,6 +291,7 @@ func (m *MMClient) parseActionPost(rmsg *Message) {
|
||||
}
|
||||
rmsg.Username = m.GetUserName(data.UserId)
|
||||
rmsg.Channel = m.GetChannelName(data.ChannelId)
|
||||
rmsg.UserID = data.UserId
|
||||
rmsg.Type = data.Type
|
||||
teamid, _ := rmsg.Raw.Data["team_id"].(string)
|
||||
// edit messsages have no team_id for some reason
|
||||
|
5
vendor/github.com/sromku/go-gitter/stream.go
generated
vendored
5
vendor/github.com/sromku/go-gitter/stream.go
generated
vendored
@ -137,7 +137,10 @@ func (stream *Stream) connect() {
|
||||
|
||||
res, err := stream.gitter.getResponse(stream.url, stream)
|
||||
if err != nil || res.StatusCode != 200 {
|
||||
stream.gitter.log(fmt.Sprintf("Failed to get response, trying reconnect (Status code: %v)", res.StatusCode))
|
||||
stream.gitter.log("Failed to get response, trying reconnect")
|
||||
if res != nil {
|
||||
stream.gitter.log(fmt.Sprintf("Status code: %v", res.StatusCode))
|
||||
}
|
||||
stream.gitter.log(err)
|
||||
|
||||
// sleep and wait
|
||||
|
2
vendor/manifest
vendored
2
vendor/manifest
vendored
@ -384,7 +384,7 @@
|
||||
"importpath": "github.com/sromku/go-gitter",
|
||||
"repository": "https://github.com/sromku/go-gitter",
|
||||
"vcs": "git",
|
||||
"revision": "0b9f26da1844acd3c6c2fd4ee2bdd30eb1a40568",
|
||||
"revision": "16aadfbb65c6641501ea8eebb6bcf23b9011912b",
|
||||
"branch": "master",
|
||||
"notests": true
|
||||
},
|
||||
|
Reference in New Issue
Block a user