Skip to content

Commit

Permalink
Handle deletion of webhook messages
Browse files Browse the repository at this point in the history
  • Loading branch information
cryox-dev committed Dec 13, 2023
1 parent b321268 commit 4ec929a
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions bridge/discord/webhook.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,21 @@ func (b *Bdiscord) webhookSend(msg *config.Message, channelID string) (*discordg
}

func (b *Bdiscord) handleEventWebhook(msg *config.Message, channelID string) (string, error) {
if msg.Event == config.EventMsgDelete {
if msg.ID == "" {
return "", nil
}

err := b.transmitter.Delete(channelID, msg.ID)
if err != nil {
b.Log.Errorf("Could not delete message: %s", err)
return "", err
}

b.Log.Infof("Message deleted successfully")
return "", nil
}

// skip events
if msg.Event != "" && msg.Event != config.EventUserAction && msg.Event != config.EventJoinLeave && msg.Event != config.EventTopicChange {
return "", nil
Expand Down

0 comments on commit 4ec929a

Please sign in to comment.