Handle deletion of webhook messages

This commit is contained in:
cryox-dev 2023-12-13 14:35:43 +13:00 committed by GitHub
parent b321268499
commit 4ec929a4bd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) { 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 // skip events
if msg.Event != "" && msg.Event != config.EventUserAction && msg.Event != config.EventJoinLeave && msg.Event != config.EventTopicChange { if msg.Event != "" && msg.Event != config.EventUserAction && msg.Event != config.EventJoinLeave && msg.Event != config.EventTopicChange {
return "", nil return "", nil