diff --git a/go.mod b/go.mod index 29f6498..89e0231 100644 --- a/go.mod +++ b/go.mod @@ -37,4 +37,4 @@ require ( maunium.net/go/mauflag v1.0.0 // indirect ) -replace github.com/bwmarrin/discordgo => github.com/beeper/discordgo v0.0.0-20230301201402-cf4c62e5f53d +replace github.com/bwmarrin/discordgo => github.com/beeper/discordgo v0.0.0-20230416132336-325ee6a8c961 diff --git a/go.sum b/go.sum index 5162303..f8c71ff 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,6 @@ github.com/DATA-DOG/go-sqlmock v1.5.0 h1:Shsta01QNfFxHCfpW6YH2STWB0MudeXXEWMr20OEh60= -github.com/beeper/discordgo v0.0.0-20230301201402-cf4c62e5f53d h1:xo6A9gSSu7mnxIXHBD1EPDyKEQFlI0N8r57Yf0gWiy8= -github.com/beeper/discordgo v0.0.0-20230301201402-cf4c62e5f53d/go.mod h1:NJZpH+1AfhIcyQsPeuBKsUtYrRnjkyu0kIVMCHkZtRY= +github.com/beeper/discordgo v0.0.0-20230416132336-325ee6a8c961 h1:eSGaliexlehYBeP4YQW8dQpV9XWWgfR1qH8kfHgrDcY= +github.com/beeper/discordgo v0.0.0-20230416132336-325ee6a8c961/go.mod h1:NJZpH+1AfhIcyQsPeuBKsUtYrRnjkyu0kIVMCHkZtRY= github.com/coreos/go-systemd/v22 v22.5.0 h1:RrqgGjYQKalulkV8NGVIfkXQf6YYmOyiJKk8iXXhfZs= github.com/coreos/go-systemd/v22 v22.5.0/go.mod h1:Y58oyj3AT4RCenI/lSvhwexgC+NSVTIJ3seZv2GcEnc= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/portal_convert.go b/portal_convert.go index c875e23..233ff9e 100644 --- a/portal_convert.go +++ b/portal_convert.go @@ -137,9 +137,20 @@ func (portal *Portal) convertDiscordAttachment(intent *appservice.IntentAPI, att content.FileName = att.Filename } + var extra map[string]any + switch strings.ToLower(strings.Split(att.ContentType, "/")[0]) { case "audio": content.MsgType = event.MsgAudio + if att.Waveform != nil { + // TODO convert waveform + extra = map[string]any{ + "org.matrix.1767.audio": map[string]any{ + "duration": int(att.DurationSeconds * 1000), + }, + "org.matrix.msc3245.voice": map[string]any{}, + } + } case "image": content.MsgType = event.MsgImage case "video": @@ -152,6 +163,7 @@ func (portal *Portal) convertDiscordAttachment(intent *appservice.IntentAPI, att AttachmentID: att.ID, Type: event.EventMessage, Content: content, + Extra: extra, } }