The picker accepts one MP4 or WebM, the thread lightbox zooms photos, and Discord gets the video as a file on a follow-up message so photo embeds still render.
This commit is contained in:
@@ -1,14 +1,27 @@
|
||||
package events
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net/url"
|
||||
"strings"
|
||||
)
|
||||
|
||||
// Image is a public photo already attached to a site post.
|
||||
// Image is a public photo or video already attached to a site post.
|
||||
type Image struct {
|
||||
URL string
|
||||
Description string
|
||||
Kind string
|
||||
}
|
||||
|
||||
// Media is a local upload still held from the create request so Discord can
|
||||
// attach the bytes. Photos carry re-encoded Bytes; videos carry an open Body.
|
||||
type Media struct {
|
||||
Name string
|
||||
ContentType string
|
||||
Kind string
|
||||
Size int64
|
||||
Body io.ReadCloser
|
||||
Bytes []byte
|
||||
}
|
||||
|
||||
// PostEvent is a Discord-free snapshot of a site post after a successful write.
|
||||
@@ -29,6 +42,8 @@ type PostEvent struct {
|
||||
// PostCreated is emitted after a successful site create.
|
||||
type PostCreated struct {
|
||||
PostEvent
|
||||
Media []Media `json:"-"`
|
||||
Release func() `json:"-"`
|
||||
}
|
||||
|
||||
// PostUpdated is emitted after a successful site edit.
|
||||
@@ -36,6 +51,13 @@ type PostUpdated struct {
|
||||
PostEvent
|
||||
}
|
||||
|
||||
// PostedToDiscord is emitted after the Discord subscriber finishes with a
|
||||
// PostCreated (sent, skipped, or failed). Release deletes held upload files.
|
||||
type PostedToDiscord struct {
|
||||
PostID string
|
||||
Release func() `json:"-"`
|
||||
}
|
||||
|
||||
// Permalink builds /questions/{root}#post-{id}, prefixed by baseURL when set.
|
||||
func Permalink(baseURL, rootID, postID string) string {
|
||||
path := "/questions/" + url.PathEscape(rootID) + "#post-" + url.PathEscape(postID)
|
||||
|
||||
Reference in New Issue
Block a user