Merge pull request #5 from ayntgl/embeds
feat: implement sendable embeds
This commit is contained in:
		
							
								
								
									
										34
									
								
								other.go
									
									
									
									
									
								
							
							
						
						
									
										34
									
								
								other.go
									
									
									
									
									
								
							| @@ -7,14 +7,27 @@ import ( | |||||||
|  |  | ||||||
| // Similar to message, but created for send message function. | // Similar to message, but created for send message function. | ||||||
| type SendMessage struct { | type SendMessage struct { | ||||||
| 	Content     string   `json:"content,omitempty"` | 	Content     string          `json:"content"` | ||||||
| 	Attachments []string `json:"attachments,omitempty"` | 	Nonce       string          `json:"nonce,omitempty"` | ||||||
| 	Nonce       string   `json:"nonce,omitempty"` | 	Attachments []string        `json:"attachments,omitempty"` | ||||||
| 	DeleteAfter uint     `json:"-"` | 	Replies     []Replies       `json:"replies,omitempty"` | ||||||
| 	Replies     []struct { | 	Embeds      []SendableEmbed `json:"embeds,omitempty"` | ||||||
| 		Id      string `json:"id,omitempty"` | 	DeleteAfter uint            `json:"-"` | ||||||
| 		Mention bool   `json:"mention"` | } | ||||||
| 	} `json:"replies,omitempty"` |  | ||||||
|  | type SendableEmbed struct { | ||||||
|  | 	Type        string `json:"type"` | ||||||
|  | 	IconUrl     string `json:"icon_url,omitempty"` | ||||||
|  | 	Url         string `json:"url,omitempty"` | ||||||
|  | 	Title       string `json:"title,omitempty"` | ||||||
|  | 	Description string `json:"description,omitempty"` | ||||||
|  | 	Media       string `json:"media,omitempty"` | ||||||
|  | 	Colour      string `json:"colour,omitempty"` | ||||||
|  | } | ||||||
|  |  | ||||||
|  | type Replies struct { | ||||||
|  | 	Id      string `json:"id"` | ||||||
|  | 	Mention bool   `json:"mention"` | ||||||
| } | } | ||||||
|  |  | ||||||
| // Set content. | // Set content. | ||||||
| @@ -43,10 +56,7 @@ func (sms *SendMessage) AddAttachment(attachment string) *SendMessage { | |||||||
|  |  | ||||||
| // Add a new reply. | // Add a new reply. | ||||||
| func (sms *SendMessage) AddReply(id string, mention bool) *SendMessage { | func (sms *SendMessage) AddReply(id string, mention bool) *SendMessage { | ||||||
| 	sms.Replies = append(sms.Replies, struct { | 	sms.Replies = append(sms.Replies, Replies{ | ||||||
| 		Id      string "json:\"id,omitempty\"" |  | ||||||
| 		Mention bool   "json:\"mention\"" |  | ||||||
| 	}{ |  | ||||||
| 		Id:      id, | 		Id:      id, | ||||||
| 		Mention: mention, | 		Mention: mention, | ||||||
| 	}) | 	}) | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user