Commit Graph

114 Commits (64b899ac8944f5bd94dfddcefeac8c0f4141be62)

Author SHA1 Message Date
Wim c23252ab53
Disable webhook editing (discord) (#1296)
See https://github.com/42wim/matterbridge/issues/1255 and
https://github.com/qaisjp/go-discord-irc/issues/57

Webhook edits gets ratelimited which cause other problems with
matterbridge. Disabling for now.
4 years ago
Simon THOBY cbb46293ab
Update webhook messages via new endpoint (discord)
When using the webhook, the previous method to edit a message was to
delete the old one via the classical API, and to create a new message
via the webhook. While this works, this means that editing "old" messages
lead to a mess where the chronological order is no longer respected.

This uses an hidden API explained in https://support.discord.com/hc/en-us/community/posts/360034557771
to achieve a proper edition using the webhook API.

The obvious downside of this approach is that since it is an
undocumented API for now, so there is no stability guarantee :/
4 years ago
Qais Patankar 9754569525
Fix webhook EventUserAction messages being skipped (discord) (#1133)
Fixes #1132
4 years ago
Qais Patankar 52a071e34d
Fix #1049: missing space before embeds (discord) (#1124) 4 years ago
Qais Patankar 2d8f749e36
Fix #1120: replaceAction "_" crash (discord) (#1121) 4 years ago
Wim eaf92fca4d
Add an ID cache (discord). Fixes #1106 (#1111)
When a webhook "edits" a message, it does this by deleting the message
and creating a new one with the new content.

On creation of this new message, we'll get another ID then already is
know by the gateway in its id cache. So we add it in our own cache and
replace it whenever we want to edit/delete it again.
4 years ago
Qais Patankar 98033b1ba7
Don't transmit typing events from ourselves (slack/discord) (#1056) 5 years ago
Qais Patankar af0acf0dae
Strip extra info from emotes (discord) (#1052) 5 years ago
Wim 281016a501
Fix duplicate separator on empty description/url (discord). Fixes #1008 (#1035)
Make this work for all possible cases.
Add tests
5 years ago
Qais Patankar 9e3bd7398c
Fix #1027: warning when handling inbound webhooks (discord) (#1044) 5 years ago
Qais Patankar 79f764c7a8 Refactor webhook permission checks 5 years ago
Qais Patankar b5dc4353fb Fix #1040: spotty webhook permission verification 5 years ago
Wim 9785edd263
Remove replace directives and use own fork to make go get work again (#1028)
See https://github.com/golang/go/issues/30354
go get doesn't honor the go.mod replace options.
5 years ago
Qais Patankar c91bfd08d8 Add ability to procure avatars from the destination bridge (#1000)
* remote_avatar: add UseLocalAvatar

* remote_avatar: make sure msg.Protocol is always set correctly

* remote_avatars: support msg.Account

* remote_avatar: add to matterbridge.toml.sample

* remote_avatar: clarify something
5 years ago
Qais Patankar 1420f68050 Check only bridged channels for PermManageWebhooks (discord) (#1001)
* Check only bridged channels for PermManageWebhooks

* add note
5 years ago
Wim b85bae31d9
Show file comment in webhook if normal message is empty (discord). Fixes #962 (#995) 5 years ago
Wim 4c44515f9d
Fix channel ID problem with multiple gateways (discord). Fixes #953 (#977) 5 years ago
c0ncord2 810c150781 move stripCustomoji logic to default Tengo script (#973)
*  move stripCustomoji logic to default Tengo script 

Removing the image ID from the message (without any possibility of recovering it later) is a loss of valuable data that prevents users from giving support to custom emoji via Tengo scripts.

* bugfix - do send colors to other irc bridges

"if we're not sending to an irc bridge we strip the IRC colors"

Co-authored-by: c0ncord <59654954+c0ncord@users.noreply.github.com>
5 years ago
Wim 0bc159341d
Update vendor (#932)
* Update vendor

* Fix godiscord api change
5 years ago
Wim ff0de85817
Remove obsolete file upload links (discord). Fixes #908 (#931)
Since v1.16.0 we now can upload files via webhook.
Old way of showing files with webhook only setup can be removed.
5 years ago
Qais Patankar ba6759010b Add UserTypingSupport (discord) (#914)
* Add Discord to UserTypingSupport

* discord: start typing in a channel on EventUserTyping receive

* discord: emit EventUserTyping to gateway
5 years ago
Wim 0abf4d5d5d
Specify correct GuildID on unknown user query (discord). Fixes #879 (#894) 5 years ago
Wim f66d5f1e58 Add extra debug info (discord) 5 years ago
MOZGIII cec086994e Add support for sending files via webhook (discord) (#872) 5 years ago
Wim 79a006c8de
Fix regression (discord). Closes #864 (#866) 5 years ago
Wim 7d2e440c83
Add support for discord category channels (discord) (#863)
This adds support for the discord category option that can be used
to group channels in. This means we can have multiple channels with
the same name.

We add the option to specify a category in the channel option of a
discord account under [[gateway]]

Besides channel="channel" or channel="ID:channelID", now also
channel="category/channel" can be specified.

This change remains backwards compatible with people that haven't
specified the category and incorporates the fix in #861
5 years ago
Qais Patankar 5551f9d56f Fix discord channel & category name clash. #860 (#861) 5 years ago
Qais Patankar e60949ff3f Support webhook message deletions (discord) (#853)
* 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.
5 years ago
Qais Patankar 76c7b69e4e Support bulk deletions (discord) 5 years ago
Wim 1829dc3d9f Allow messages from other bots (discord). Fixes #816 5 years ago
Wim af00c34aac
Do not relay any bot messages (discord) (#743) 6 years ago
Wim b09a73040f
Print errors as string instead of %#v (#738) 6 years ago
Declan Hoare a7dd033c3b Allow sending discriminator with Discord username (#726) 6 years ago
Wim 0bcb0b882f
Support join/leaves from discord. Closes #654 (#721) 6 years ago
Wim e3cb665d92 Make discord user token work correctly (discord) #689 6 years ago
Wim d99eacc2e1 Run go fmt 6 years ago
Zomboy Alfrir 62e55214fc Allow to bridge non-bot Discord users (discord) (#689)
If you prefix a token with `User ` it'll treat is as a user token.

Co-Authored-By: zomboy-alfrir <zomboy@dancodes.com.ar>
6 years ago
James Nylen 5193634a52 Use only one webhook if possible (discord) (#681) 6 years ago
Wim 46e2683995 Add file comment to webhook messages (discord). Fixes #358 6 years ago
James Nylen 492722af8b Improve error reporting on failure to join Discord. Fixes #672 (#680) 6 years ago
Wim f72d5de2d7 Disable some unparam checks (discord) 6 years ago
Duco van Amstel 0365c0786a Split Discord bridge in multiple files (#632) 6 years ago
Wim df02f51c56 Fix regression on using server ID (discord). #619 #617 6 years ago
Wim c6fd65d1d7 Limit discord username via webhook to 32 chars 6 years ago
Duco van Amstel ce21ba1545 Fix golint linter issues and enable it in CI (#593) 6 years ago
Wim f8dc24bc09 Switch back go upstream bwmarrin/discordgo
Commit ffa9956c9b got merged in.
6 years ago
Wim 399789811e Make gocritic linter happy 6 years ago
David Hill 0e2522279e Clean up various stuff (#508)
* various cleanups
6 years ago
NikkyAI 54adb0509e Fix mentions cuttíng off all text after the mention (discord) (#506) 6 years ago
Wim bd3a3b6eaf Let webhook also replace mentions (discord). Closes #502 6 years ago