mirror of
				https://github.com/matrix-org/gomatrix
				synced 2025-11-04 06:18:05 +00:00 
			
		
		
		
	add SendHTML method
This commit is contained in:
		
							parent
							
								
									385f072fe9
								
							
						
					
					
						commit
						d19b100769
					
				
					 1 changed files with 10 additions and 0 deletions
				
			
		
							
								
								
									
										10
									
								
								client.go
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								client.go
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -464,6 +464,16 @@ func (cli *Client) SendText(roomID, text string) (*RespSendEvent, error) {
 | 
			
		|||
		TextMessage{"m.text", text})
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SendHTML sends an m.room.message event into the given room with a msgtype of m.text and using the org.matrix.custom.html formatting.
 | 
			
		||||
// See http://matrix.org/docs/spec/client_server/r0.2.0.html#m-text
 | 
			
		||||
func (cli *Client) SendHTML(roomID, msgtype, htmlText string) (*RespSendEvent, error) {
 | 
			
		||||
	if msgtype == "" {
 | 
			
		||||
		msgtype = "m.text"
 | 
			
		||||
	}
 | 
			
		||||
	return cli.SendMessageEvent(roomID, "m.room.message",
 | 
			
		||||
		GetHTMLMessage(msgtype, htmlText))
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// SendImage sends an m.room.message event into the given room with a msgtype of m.image
 | 
			
		||||
// See https://matrix.org/docs/spec/client_server/r0.2.0.html#m-image
 | 
			
		||||
func (cli *Client) SendImage(roomID, body, url string) (*RespSendEvent, error) {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue