Disable web preview for telegram webhook (#6719)
This commit is contained in:
		
							parent
							
								
									2a0e86d5f2
								
							
						
					
					
						commit
						cbf8538635
					
				
					 1 changed files with 4 additions and 2 deletions
				
			
		| 
						 | 
				
			
			@ -17,8 +17,9 @@ import (
 | 
			
		|||
type (
 | 
			
		||||
	// TelegramPayload represents
 | 
			
		||||
	TelegramPayload struct {
 | 
			
		||||
		Message   string `json:"text"`
 | 
			
		||||
		ParseMode string `json:"parse_mode"`
 | 
			
		||||
		Message           string `json:"text"`
 | 
			
		||||
		ParseMode         string `json:"parse_mode"`
 | 
			
		||||
		DisableWebPreview bool   `json:"disable_web_page_preview"`
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// TelegramMeta contains the telegram metadata
 | 
			
		||||
| 
						 | 
				
			
			@ -34,6 +35,7 @@ func (p *TelegramPayload) SetSecret(_ string) {}
 | 
			
		|||
// JSONPayload Marshals the TelegramPayload to json
 | 
			
		||||
func (p *TelegramPayload) JSONPayload() ([]byte, error) {
 | 
			
		||||
	p.ParseMode = "HTML"
 | 
			
		||||
	p.DisableWebPreview = true
 | 
			
		||||
	p.Message = markup.Sanitize(p.Message)
 | 
			
		||||
	data, err := json.MarshalIndent(p, "", "  ")
 | 
			
		||||
	if err != nil {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue