summaryrefslogtreecommitdiffstats
path: root/bridge/discord
diff options
context:
space:
mode:
Diffstat (limited to 'bridge/discord')
-rw-r--r--bridge/discord/discord.go1
-rw-r--r--bridge/discord/handlers.go21
2 files changed, 22 insertions, 0 deletions
diff --git a/bridge/discord/discord.go b/bridge/discord/discord.go
index 49dfe4bc..ea43bd20 100644
--- a/bridge/discord/discord.go
+++ b/bridge/discord/discord.go
@@ -75,6 +75,7 @@ func (b *Bdiscord) Connect() error {
b.c.AddHandler(b.memberUpdate)
b.c.AddHandler(b.messageUpdate)
b.c.AddHandler(b.messageDelete)
+ b.c.AddHandler(b.messageDeleteBulk)
b.c.AddHandler(b.memberAdd)
b.c.AddHandler(b.memberRemove)
err = b.c.Open()
diff --git a/bridge/discord/handlers.go b/bridge/discord/handlers.go
index 85a36e1d..19e0ad6a 100644
--- a/bridge/discord/handlers.go
+++ b/bridge/discord/handlers.go
@@ -16,6 +16,27 @@ func (b *Bdiscord) messageDelete(s *discordgo.Session, m *discordgo.MessageDelet
b.Remote <- rmsg
}
+// TODO(qaisjp): if other bridges support bulk deletions, it could be fanned out centrally
+func (b *Bdiscord) messageDeleteBulk(s *discordgo.Session, m *discordgo.MessageDeleteBulk) { //nolint:unparam
+ for _, msgID := range m.Messages {
+ rmsg := config.Message{
+ Account: b.Account,
+ ID: msgID,
+ Event: config.EventMsgDelete,
+ Text: config.EventMsgDelete,
+ Channel: "ID:" + m.ChannelID,
+ }
+
+ if !b.useChannelID {
+ rmsg.Channel = b.getChannelName(m.ChannelID)
+ }
+
+ b.Log.Debugf("<= Sending message from %s to gateway", b.Account)
+ b.Log.Debugf("<= Message is %#v", rmsg)
+ b.Remote <- rmsg
+ }
+}
+
func (b *Bdiscord) messageUpdate(s *discordgo.Session, m *discordgo.MessageUpdate) { //nolint:unparam
if b.GetBool("EditDisable") {
return