We create a new event EventFileDelete which will be used to delete
specific uploaded files using the Extra["file"] in the config.Message.
We also add a new NativeID key to the FileInfo struct which will contain
the native file ID of the sending bridge.
When a new file is added to the config.Message.Extra["file"] map, now
the bridge native file ID should be added here.
When the receiving bridge receives such a message, it should keep an
internal mapping of NativeID <> bridge fileid/message id. In the case of
discord we map it to the resulted discord message ID after uploading it.
Now when a bridge deletes a file, it should send a EventFileDelete and
setting the ID to the native file ID of the bridge.
When the receiving bridge will get this event it'll look into the
NativeID <> bridge id mapping to find their internal ID and use it to
delete the specific file on their side.
For now this is implemented for slack to discord but this will be add to
other bridges where useful.
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.
Webhooks don't support the threading yet, so this is token only.
In discord you can reply on each message of a thread, but this is not possible in mattermost (so some changes added there to make sure we always answer on the rootID of the thread).
Also needs some more testing with slack.
update : It now also uses the token when replying to a thread (even if webhooks are enabled), until webhooks have support for threads.
* Add UserID to RemoteNickFormat and Tengo
* Use strings.ReplaceAll in gateway.modifyUsername
Fixes a warning from gocritic linter.
* Use Unicode escape sequence instead of raw ZWSP in gateway.modifyUsername
Fixes a warning from stylecheck linter.
Currently, the "topic_change" events are ignored if both,
ShowTopicChange and SyncTopic are set, and forwarded otherwise.
This pull requests changes the behavior such that the events are
only forwarded if one of those two config options is set to true
and ignored otherwise.
Fail if:
* we don't have any gateways configured
* we have gateways configured but with non-existing bridge configuration
* we have gateways configured without any configuration
* initial work on native keybase bridging
* Hopefully make a functional keybase bridge
* add keybase to bridgemap
* send to right channel, try to figure out received msgs
* add account and userid
* i am a Dam Fool
* Fix formatting for messages, handle /me
* update vendors, ran golint and goimports
* move handlers to handlers.go, clean up unused config options
* add sample config, fix inconsistent remote nick handling
* Update readme with keybase links
* Resolve fixmie errors
* Error -> Errorf
* fix linting errors in go.mod and go.sum
* explicitly join channels, ignore messages from non-specified channels
* check that team names match before bridging message
* Support webhook message deletions (discord)
Messages sent via webhook can now be deleted. It seems it can do this
without any special permissions.
This copies discordgo.WebhookExecute and makes it support the returning
of discordgo.Message.
A pull request has been sent upstream, so we should use that if
@bwmariin accepts the pull request:
https://github.com/bwmarrin/discordgo/pull/663
Changes in behaviour (webhook mode only):
- Previously messages *edited* on other platforms would just be
retransmitted as a brand new message to Discord.
- Message *edits* will now be ignored.
- Debug: message edits will now print out a "permission error".
In the future it may be good to send an "message edited" react to those
webhook messages, so at least people know that the message was edited on
other platforms. (Even though it can't actually show the new message.)
Alternatively, message edits could just send a brand new message with a
link back to the old one. This is a little ugly but it would ensure that
Discord users are able to see the edited message. These "message edit
notifications" would be sent from the bot user (not from a webhook), so
we could edit the "edit notification" if subsequent edits to the
original message are made.
Fixes issue #814.
This is a somewhat hacky way of achieving the required goal but it seems
like this is the least problematic way of getting there.
We might want to redesign some bridge information later such that we
have a standardised way of specifying what is and what isn't supported
by each chat protocol / bridge.
Adds a new key OutMessage under [tengo] table, which specifies the location of the script that
will be invoked on each message being sent to a bridge and can be used to modify the Username
and the Text of that message.
The script will have the following global variables:
read-only:
inAccount, inProtocol, inChannel, inGateway
outAccount, outProtocol, outChannel, outGateway
read-write:
msgText, msgUsername
The script is reloaded on every message, so you can modify the script on the fly.
The default script in https://github.com/42wim/matterbridge/tree/master/internal/tengo/outmessage.tengo
is compiled in and will be executed if no script is specified.
This commit add support for using the result of a tengo script in RemoteNickFormat using {TENGO}
Also adds a new toml table [tengo] with key RemoteNickFormat and value location of the script.
This also moves the TengoModifyMessage from [general] to Message in [tengo]
Documentation:
RemoteNickFormat allows you to specify the location of a tengo (https://github.com/d5/tengo/) script.
The script will have the following global variables:
to modify: result
to read: channel, bridge, gateway, protocol, nick
The result will be set in {TENGO} in the RemoteNickFormat key of every bridge where {TENGO} is specified
The script is reloaded on every message, so you can modify the script on the fly.
Example script can be found in https://github.com/42wim/matterbridge/tree/master/contrib/remotenickformat.tengo
[tengo]
RemoteNickFormat="remotenickformat.tengo"
Revert "Fix typo"
This reverts commit dffd67eb31.
Revert "Handle quit message relay better on gateways with one channel on the irc bridge #722"
This reverts commit 240559581a.
Revert "Support quits from irc correctly. Fixes#722 (#724)"
This reverts commit d76a04bd0a.
Breaking change for zulip channel configuration.
For zulip the channel configuration will now need to specify also
the topic with /topic:yourtopic.
Example:
[[gateway.inout]]
account="zulip.streamchat"
channel="general/topic:mytopic"
This fixes the incorrect PR #701 which didn't work with multiple
gateways.
some examples:
this replaces a message like "Relaybot: <relayeduser> something interesting" to "relayeduser: something interesting"
ExtractNicks=[ [ "Relaybot", "<(.*?)>\\s+" ] ]
you can use multiple entries for multiplebots
this also replaces a message like "otherbot: (relayeduser) something else" to "relayeduser: something else"
ExtractNicks=[ [ "Relaybot", "<(.*?)>\\s+" ],[ "otherbot","\\((.*?)\\)\\s+" ]
OPTIONAL (default empty)
ExtractNicks=[ ["otherbot","<(.*?)>\\s+" ] ]