mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-06-26 13:09:24 +00:00
Compare commits
7 Commits
v0.16.0-rc
...
v0.16.0
Author | SHA1 | Date | |
---|---|---|---|
4bed073c65 | |||
272735fb26 | |||
b75cf2c189 | |||
1aaa992250 | |||
6256c066f1 | |||
870b89a8f0 | |||
65ac96913c |
2
.github/ISSUE_TEMPLATE.md
vendored
2
.github/ISSUE_TEMPLATE.md
vendored
@ -1,3 +1,5 @@
|
||||
If you have a configuration problem, please first try to create a basic configuration following the instructions on [the wiki](https://github.com/42wim/matterbridge/wiki/How-to-create-your-config) before filing an issue.
|
||||
|
||||
Please answer the following questions.
|
||||
|
||||
### Which version of matterbridge are you using?
|
||||
|
@ -30,7 +30,7 @@ Has a REST API.
|
||||
|
||||
# Requirements
|
||||
Accounts to one of the supported bridges
|
||||
* [Mattermost](https://github.com/mattermost/platform/) 3.5.x - 3.10.x
|
||||
* [Mattermost](https://github.com/mattermost/platform/) 3.5.x - 3.10.x, 4.0.x
|
||||
* [IRC](http://www.mirc.com/servers.html)
|
||||
* [XMPP](https://jabber.org)
|
||||
* [Gitter](https://gitter.im)
|
||||
@ -45,8 +45,7 @@ Accounts to one of the supported bridges
|
||||
# Installing
|
||||
## Binaries
|
||||
Binaries can be found [here] (https://github.com/42wim/matterbridge/releases/)
|
||||
* Latest rc release (with steam support) [v0.16.0-rc2](https://github.com/42wim/matterbridge/releases/latest)
|
||||
* Latest stable release [v0.15.0](https://github.com/42wim/matterbridge/releases/tag/v0.15.0)
|
||||
* Latest stable release [v0.16.0](https://github.com/42wim/matterbridge/releases/tag/v0.16.0)
|
||||
|
||||
## 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)
|
||||
@ -181,6 +180,6 @@ Matterbridge wouldn't exist without these libraries:
|
||||
* mattermost - https://github.com/mattermost/platform
|
||||
* matrix - https://github.com/matrix-org/gomatrix
|
||||
* 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
|
||||
|
||||
|
@ -153,33 +153,41 @@ func (b *bdiscord) messageCreate(s *discordgo.Session, m *discordgo.MessageCreat
|
||||
if b.Config.WebhookURL != "" && m.Author.Bot && m.Author.ID == b.webhookID {
|
||||
return
|
||||
}
|
||||
|
||||
if len(m.Attachments) > 0 {
|
||||
for _, attach := range m.Attachments {
|
||||
m.Content = m.Content + "\n" + attach.URL
|
||||
}
|
||||
}
|
||||
if m.Content == "" {
|
||||
return
|
||||
|
||||
var text string
|
||||
if m.Content != "" {
|
||||
flog.Debugf("Receiving message %#v", m.Message)
|
||||
if len(m.MentionRoles) > 0 {
|
||||
m.Message.Content = b.replaceRoleMentions(m.Message.Content)
|
||||
}
|
||||
m.Message.Content = b.stripCustomoji(m.Message.Content)
|
||||
m.Message.Content = b.replaceChannelMentions(m.Message.Content)
|
||||
text = m.ContentWithMentionsReplaced()
|
||||
}
|
||||
flog.Debugf("Receiving message %#v", m.Message)
|
||||
|
||||
channelName := b.getChannelName(m.ChannelID)
|
||||
if b.UseChannelID {
|
||||
channelName = "ID:" + m.ChannelID
|
||||
}
|
||||
username := b.getNick(m.Author)
|
||||
if len(m.MentionRoles) > 0 {
|
||||
m.Message.Content = b.replaceRoleMentions(m.Message.Content)
|
||||
}
|
||||
m.Message.Content = b.stripCustomoji(m.Message.Content)
|
||||
m.Message.Content = b.replaceChannelMentions(m.Message.Content)
|
||||
|
||||
text := m.ContentWithMentionsReplaced()
|
||||
if b.Config.ShowEmbeds && m.Message.Embeds != nil {
|
||||
for _, embed := range m.Message.Embeds {
|
||||
text = text + "embed: " + embed.Title + " - " + embed.Description + " - " + embed.URL + "\n"
|
||||
}
|
||||
}
|
||||
|
||||
// no empty messages
|
||||
if text == "" {
|
||||
return
|
||||
}
|
||||
|
||||
flog.Debugf("Sending message from %s on %s to gateway", m.Author.Username, b.Account)
|
||||
b.Remote <- config.Message{Username: username, Text: text, Channel: channelName,
|
||||
Account: b.Account, Avatar: "https://cdn.discordapp.com/avatars/" + m.Author.ID + "/" + m.Author.Avatar + ".jpg",
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"github.com/42wim/matterbridge/matterhook"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/nlopes/slack"
|
||||
"html"
|
||||
"regexp"
|
||||
"strings"
|
||||
"time"
|
||||
@ -192,6 +193,7 @@ func (b *Bslack) handleSlack() {
|
||||
texts := strings.Split(message.Text, "\n")
|
||||
for _, text := range texts {
|
||||
text = b.replaceURL(text)
|
||||
text = html.UnescapeString(text)
|
||||
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), UserID: message.UserID}
|
||||
}
|
||||
|
36
changelog.md
36
changelog.md
@ -1,3 +1,39 @@
|
||||
# v0.16.0
|
||||
## Breaking Changes
|
||||
* URL,UseAPI,BindAddress is deprecated. Your config has to be updated.
|
||||
* URL => WebhookURL
|
||||
* BindAddress => WebhookBindAddress
|
||||
* UseAPI => removed
|
||||
This change allows you to specify a WebhookURL and a token (slack,discord), so that
|
||||
messages will be sent with the webhook, but received via the token (API)
|
||||
If you have not specified WebhookURL and WebhookBindAddress the API (login or token)
|
||||
will be used automatically. (no need for UseAPI)
|
||||
|
||||
## New features
|
||||
* mattermost: add support for mattermost 4.0
|
||||
* steam: New protocol support added (http://store.steampowered.com/)
|
||||
* discord: Support for embedded messages (sent by other bots)
|
||||
Shows title, description and URL of embedded messages (sent by other bots)
|
||||
To enable add ```ShowEmbeds=true``` to your discord config
|
||||
* discord: ```WebhookURL``` posting support added (thanks @saury07) #204
|
||||
Discord API does not allow to change the name of the user posting, but webhooks does.
|
||||
|
||||
## Changes
|
||||
* general: all :emoji: will be converted to unicode, providing consistent emojis across all bridges
|
||||
* telegram: Add ```UseInsecureURL``` option for telegram (default false)
|
||||
WARNING! If enabled this will relay GIF/stickers/documents and other attachments as URLs
|
||||
Those URLs will contain your bot-token. This may not be what you want.
|
||||
For now there is no secure way to relay GIF/stickers/documents without seeing your token.
|
||||
|
||||
## Bugfix
|
||||
* irc: detect charset and try to convert it to utf-8 before sending it to other bridges. #209 #210
|
||||
* slack: Remove label from URLs (slack). #205
|
||||
* slack: Relay <>& correctly to other bridges #215
|
||||
* steam: Fix channel id bug in steam (channels are off by 0x18000000000000)
|
||||
* general: various improvements
|
||||
* general: samechannelgateway now relays messages correct again #207
|
||||
|
||||
|
||||
# v0.16.0-rc2
|
||||
## Breaking Changes
|
||||
* URL,UseAPI,BindAddress is deprecated. Your config has to be updated.
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"github.com/42wim/matterbridge/bridge"
|
||||
"github.com/42wim/matterbridge/bridge/config"
|
||||
log "github.com/Sirupsen/logrus"
|
||||
"github.com/peterhellberg/emojilib"
|
||||
// "github.com/davecgh/go-spew/spew"
|
||||
"regexp"
|
||||
"strings"
|
||||
@ -116,6 +117,7 @@ func (gw *Gateway) handleReceive() {
|
||||
}
|
||||
if !gw.ignoreMessage(&msg) {
|
||||
msg.Timestamp = time.Now()
|
||||
gw.modifyMessage(&msg)
|
||||
for _, br := range gw.Bridges {
|
||||
gw.handleMessage(msg, br)
|
||||
}
|
||||
@ -296,6 +298,11 @@ func (gw *Gateway) modifyAvatar(msg *config.Message, dest *bridge.Bridge) {
|
||||
}
|
||||
}
|
||||
|
||||
func (gw *Gateway) modifyMessage(msg *config.Message) {
|
||||
// replace :emoji: to unicode
|
||||
msg.Text = emojilib.Replace(msg.Text)
|
||||
}
|
||||
|
||||
func getChannelID(msg config.Message) string {
|
||||
return msg.Channel + msg.Account
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
)
|
||||
|
||||
var (
|
||||
version = "0.16.0-rc2"
|
||||
version = "0.16.0"
|
||||
githash string
|
||||
)
|
||||
|
||||
|
@ -833,7 +833,8 @@ func supportedVersion(version string) bool {
|
||||
strings.HasPrefix(version, "3.7.0") ||
|
||||
strings.HasPrefix(version, "3.8.0") ||
|
||||
strings.HasPrefix(version, "3.9.0") ||
|
||||
strings.HasPrefix(version, "3.10.0") {
|
||||
strings.HasPrefix(version, "3.10.0") ||
|
||||
strings.HasPrefix(version, "4.0") {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
|
19
vendor/github.com/peterhellberg/emojilib/LICENSE
generated
vendored
Normal file
19
vendor/github.com/peterhellberg/emojilib/LICENSE
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
Copyright (c) 2015-2017 Peter Hellberg https://c7.se/
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining
|
||||
a copy of this software and associated documentation files (the "Software"),
|
||||
to deal in the Software without restriction, including without limitation
|
||||
the rights to use, copy, modify, merge, publish, distribute, sublicense,
|
||||
and/or sell copies of the Software, and to permit persons to whom the
|
||||
Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included
|
||||
in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
||||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
|
||||
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
||||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
|
||||
DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
||||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE
|
||||
OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
88
vendor/github.com/peterhellberg/emojilib/emojilib.go
generated
vendored
Normal file
88
vendor/github.com/peterhellberg/emojilib/emojilib.go
generated
vendored
Normal file
@ -0,0 +1,88 @@
|
||||
/*
|
||||
|
||||
Package emojilib is a port of the Emoji keyword library to Go
|
||||
|
||||
Installation
|
||||
|
||||
Just go get the package:
|
||||
|
||||
go get -u github.com/peterhellberg/emojilib
|
||||
|
||||
Usage
|
||||
|
||||
A small usage example
|
||||
|
||||
package main
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
|
||||
"github.com/peterhellberg/emojilib"
|
||||
)
|
||||
|
||||
func main() {
|
||||
fmt.Println(emojilib.ReplaceWithPadding("I :green_heart: You!"))
|
||||
}
|
||||
|
||||
*/
|
||||
package emojilib
|
||||
|
||||
import "errors"
|
||||
|
||||
//go:generate go run _generator/main.go
|
||||
|
||||
// Emojis contain emojis keyed on their name
|
||||
type Emojis map[string]Emoji
|
||||
|
||||
// Emoji contains the keywords, char and category for an emoji
|
||||
type Emoji struct {
|
||||
Keywords []string `json:"keywords"`
|
||||
Char string `json:"char"`
|
||||
Category string `json:"category"`
|
||||
}
|
||||
|
||||
// ErrUnknownEmoji is returned from Find if provided with a unknown emoji name
|
||||
var ErrUnknownEmoji = errors.New("unknown emoji")
|
||||
|
||||
// ErrUnknownKeyword is returned from Keyword if provided with a unknown keyword
|
||||
var ErrUnknownKeyword = errors.New("unknown keyword")
|
||||
|
||||
// Find returns an Emoji if provided with a known name
|
||||
func Find(n string) (Emoji, error) {
|
||||
if e, ok := emojis[n]; ok {
|
||||
return e, nil
|
||||
}
|
||||
|
||||
return Emoji{}, ErrUnknownEmoji
|
||||
}
|
||||
|
||||
// Keyword returns Emojis for the given keyword
|
||||
func Keyword(k string) ([]Emoji, error) {
|
||||
if names, ok := keywordLookup[k]; ok {
|
||||
es := []Emoji{}
|
||||
|
||||
for _, n := range names {
|
||||
es = append(es, emojis[n])
|
||||
}
|
||||
|
||||
return es, nil
|
||||
}
|
||||
|
||||
return []Emoji{}, ErrUnknownKeyword
|
||||
}
|
||||
|
||||
// All returns all the emojis
|
||||
func All() Emojis {
|
||||
return emojis
|
||||
}
|
||||
|
||||
// Replace takes a string and replaces all emoji names with their emoji character
|
||||
func Replace(s string) string {
|
||||
return emojiReplacer.Replace(s)
|
||||
}
|
||||
|
||||
// ReplaceWithPadding takes a string and replaces all emoji names with their
|
||||
// emoji character and a space in order to display better in terminals
|
||||
func ReplaceWithPadding(s string) string {
|
||||
return emojiPaddedReplacer.Replace(s)
|
||||
}
|
19620
vendor/github.com/peterhellberg/emojilib/generated.go
generated
vendored
Normal file
19620
vendor/github.com/peterhellberg/emojilib/generated.go
generated
vendored
Normal file
File diff suppressed because it is too large
Load Diff
8
vendor/manifest
vendored
8
vendor/manifest
vendored
@ -416,6 +416,14 @@
|
||||
"branch": "master",
|
||||
"notests": true
|
||||
},
|
||||
{
|
||||
"importpath": "github.com/peterhellberg/emojilib",
|
||||
"repository": "https://github.com/peterhellberg/emojilib",
|
||||
"vcs": "git",
|
||||
"revision": "41920917e2710c9f0ec22d29db182f60e7ed9d11",
|
||||
"branch": "master",
|
||||
"notests": true
|
||||
},
|
||||
{
|
||||
"importpath": "github.com/peterhellberg/giphy",
|
||||
"repository": "https://github.com/peterhellberg/giphy",
|
||||
|
Reference in New Issue
Block a user