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.
Stop getting users if we reach 2000 users. Slack will rate-limit us
even if we follow their limits.
This means that we now have to lookup every user that says a message
for the first time. This should be less intensive on the API.
This also disables partly fb713ed91b for now.
ChannelMembers will not be filled.
* Add initial support for getting ChannelMember info of all bridges.
Adds an EventGetChannelMembers event, which gets send every x time to
all bridges. Bridges should respond on this event with a Message
containing ChannelMembers in the EventGetChannelMembers key in the
Extra field.
handleEventGetChannelMembers will handle this Message and sets the
contained ChannelMembers to the Bridge struct.
* Add ChannelMembers support to the slack bridge
When setting wait to true, we wait until the populating isn't in progress anymore.
This is used on startup connections where we really need the initial information
which could take a long time on big servers.
* Opportunistically preserve Slack threading when parent thread in cache. [#529]
* Removed slack-specific processing from gateway.
* Added docs.
* Add option to enable threading, with default to off.
* Did cleanup on @42wim's comments.
* Update gateway/gateway.go
Co-Authored-By: patcon <patrick.c.connolly@gmail.com>
* Suggestion from @42wim :)
* Suggestions from @42wim.
* More suggestions.
Changes include:
- Refactor of strings into package-wide constants.
- Predeclaration of regexps to be instantiated at package load time.
- Checking of unchecked errors.
- Structural changes:
- Adding verifications to type-casting code.
- Remove unnecessary 'len(X) > 0' checks before iterating over X.
- Remove unnecessary 'else' clause after 'if' with 'return'.
- Unexporting of public fields of Bridge struct.
- Formatting:
- One-field-per-line struct definitions.