added message structs.
This commit is contained in:
parent
3adfcd339a
commit
a3cf0d8e4e
1
go.mod
1
go.mod
@ -4,6 +4,7 @@ go 1.17
|
||||
|
||||
require (
|
||||
github.com/gorilla/websocket v1.4.2 // indirect
|
||||
github.com/oklog/ulid/v2 v2.0.2 // indirect
|
||||
github.com/sacOO7/go-logger v0.0.0-20180719173527-9ac9add5a50d // indirect
|
||||
github.com/sacOO7/gowebsocket v0.0.0-20210515122958-9396f1a71e23 // indirect
|
||||
)
|
||||
|
3
go.sum
3
go.sum
@ -1,5 +1,8 @@
|
||||
github.com/gorilla/websocket v1.4.2 h1:+/TMaTYc4QFitKJxsQ7Yye35DkWvkdLcvGKqM+x0Ufc=
|
||||
github.com/gorilla/websocket v1.4.2/go.mod h1:YR8l580nyteQvAITg2hZ9XVh4b55+EU/adAjf1fMHhE=
|
||||
github.com/oklog/ulid/v2 v2.0.2 h1:r4fFzBm+bv0wNKNh5eXTwU7i85y5x+uwkxCUTNVQqLc=
|
||||
github.com/oklog/ulid/v2 v2.0.2/go.mod h1:mtBL0Qe/0HAx6/a4Z30qxVIAL1eQDweXq5lxOEiwQ68=
|
||||
github.com/pborman/getopt v0.0.0-20170112200414-7148bc3a4c30/go.mod h1:85jBQOZwpVEaDAr341tbn15RS4fCAsIst0qp7i8ex1o=
|
||||
github.com/sacOO7/go-logger v0.0.0-20180719173527-9ac9add5a50d h1:5T+fbRuQbpi+WZtB2yfuu59r00F6T2HV/zGYrwX8nvE=
|
||||
github.com/sacOO7/go-logger v0.0.0-20180719173527-9ac9add5a50d/go.mod h1:L5EJe2k8GwpBoGXDRLAEs58R239jpZuE7NNEtW+T7oo=
|
||||
github.com/sacOO7/gowebsocket v0.0.0-20210515122958-9396f1a71e23 h1:yjnkNJTpQPCx10KF1jypuIhAVc6EYn2M9lJgwSTHQYs=
|
||||
|
73
message.go
Normal file
73
message.go
Normal file
@ -0,0 +1,73 @@
|
||||
package revoltgo
|
||||
|
||||
// Message struct
|
||||
type Message struct {
|
||||
Client *Client
|
||||
|
||||
Id string `json:"_id"`
|
||||
Nonce string `json:"nonce"`
|
||||
ChannelId string `json:"channel"`
|
||||
AuthorId string `json:"author"`
|
||||
Content string `json:"content"`
|
||||
Attachments []*Attachment `json:"attachments"`
|
||||
Mentions []string `json:"mentions"`
|
||||
Replies []string `json:"replies"`
|
||||
}
|
||||
|
||||
// Attachment struct.
|
||||
type Attachment struct {
|
||||
Id string `json:"_id"`
|
||||
Tag string `json:"tag"`
|
||||
Size int `json:"size"`
|
||||
FileName string `json:"filename"`
|
||||
Metadata *AttachmentMetadata
|
||||
ContentType string `json:"content_type"`
|
||||
Embeds []*MessageEmbed
|
||||
}
|
||||
|
||||
// Attachment metadata struct.
|
||||
type AttachmentMetadata struct {
|
||||
Type string `json:"type"`
|
||||
Width int `json:"width"`
|
||||
Height int `json:"height"`
|
||||
}
|
||||
|
||||
// Message edited struct.
|
||||
type MessageEdited struct {
|
||||
Date int `json:"$date"`
|
||||
}
|
||||
|
||||
// Message embed struct.
|
||||
type MessageEmbed struct {
|
||||
Type string `json:"type"`
|
||||
Url string `json:"url"`
|
||||
Special *MessageSpecialEmbed
|
||||
Title string `json:"title"`
|
||||
Description string `json:"description"`
|
||||
Image *MessageEmbeddedImage `json:"image"`
|
||||
Video *MessageEmbeddedVideo `json:"video"`
|
||||
IconUrl string `json:"icon_url"`
|
||||
Color string `json:"color"`
|
||||
}
|
||||
|
||||
// Message special embed struct.
|
||||
type MessageSpecialEmbed struct {
|
||||
Type string `json:"type"`
|
||||
Id string `json:"id"`
|
||||
ContentType string `json:"content_type"`
|
||||
}
|
||||
|
||||
// Message embedded image struct
|
||||
type MessageEmbeddedImage struct {
|
||||
Size string `json:"size"`
|
||||
Url string `json:"url"`
|
||||
Width int `json:"width"`
|
||||
Height int `json:"height"`
|
||||
}
|
||||
|
||||
// Message embedded video struct
|
||||
type MessageEmbeddedVideo struct {
|
||||
Url string `json:"url"`
|
||||
Width int `json:"width"`
|
||||
Height int `json:"height"`
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user